Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8479109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:56:01+00:00 2026-06-10T18:56:01+00:00

I have a very simple RichTextBox control in a silverlight 5 application. <RichTextBox x:Name=rtbControl

  • 0

I have a very simple RichTextBox control in a silverlight 5 application.

<RichTextBox x:Name="rtbControl" 
    Height="Auto" 
    ContentChanged="rtbControl_ContentChanged" />

As the data is changed, i capture it in a local variable as so:

    private void rtbControl_ContentChanged(object sender, ContentChangedEventArgs e)
    {
        RichTextContent = rtbControl.Xaml;
    }

All works. However, if I type in just a few words and examine the <Paragraph> markup, it is HUGE! A snippet is below. Is there a way to not have all the Typography stuff in the markup? Why is it there and is it needed? Is there a way to remove it?

<Section xml:space="preserve" HasTrailingParagraphBreakOnPaste="False" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Paragraph FontSize="11" FontFamily="Segoe UI" Foreground="#FF000000" FontWeight="Normal" FontStyle="Normal" FontStretch="Normal" 
CharacterSpacing="0" Typography.AnnotationAlternates="0" Typography.EastAsianExpertForms="False" Typography.EastAsianLanguage="Normal" 
Typography.EastAsianWidths="Normal" Typography.StandardLigatures="True" Typography.ContextualLigatures="True" 
Typography.DiscretionaryLigatures="False" Typography.HistoricalLigatures="False" Typography.StandardSwashes="0" Typography.ContextualSwashes="0" 
Typography.ContextualAlternates="True" Typography.StylisticAlternates="0" Typography.StylisticSet1="False" Typography.StylisticSet2="False"
 Typography.StylisticSet3="False" Typography.StylisticSet4="False" Typography.StylisticSet5="False" Typography.StylisticSet6="False" Typography.StylisticSet7="False" 
Typography.StylisticSet8="False" Typography.StylisticSet9="False" Typography.StylisticSet10="False" Typography.StylisticSet11="False" 
Typography.StylisticSet12="False" Typography.StylisticSet13="False" Typography.StylisticSet14="False" Typography.StylisticSet15="False" 
Typography.StylisticSet16="False" Typography.StylisticSet17="False" Typography.StylisticSet18="False" Typography.StylisticSet19="False" 
Typography.StylisticSet20="False" Typography.Capitals="Normal" Typography.CapitalSpacing="False" Typography.Kerning="True" Typography.CaseSensitiveForms="False" 
Typography.HistoricalForms="False" Typography.Fraction="Normal" Typography.NumeralStyle="Normal" Typography.NumeralAlignment="Normal" Typography.SlashedZero="False"
 Typography.MathematicalGreek="False" Typography.Variants="Normal" TextOptions.TextHintingMode="Fixed" TextOptions.TextFormattingMode="Ideal" 
TextOptions.TextRenderingMode="Auto" TextAlignment="Left" LineHeight="0" LineStackingStrategy="MaxHeight"><Run>was it a </Run><Run TextDecorations="Underline">bad 
</Run><Run>blah? or </Run></Paragraph></section>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:56:02+00:00Added an answer on June 10, 2026 at 6:56 pm

    I thought I would share my solution to help others… its been in place for several months and I havent seen any bad side effects.

    I created some extention methods to assist in removing the Typography attributes.

    public static class RichTextBoxExtensions {
            // <summary>
            /// Removes any xml tag with the prefix given from a string
            /// </summary>
            /// <param name="XMLString"></param>
            /// <param name="TagPrefix"></param>
            /// <returns></returns>
            public static string RemoveXMLAttributesFromNode(this string XMLString, string prefix)
            {
                //Match [Prefix][any number of Not =][=]["][any number of Not "]["][ ] <-must have space!!!
                string replace = prefix + "[^\\=]*=\"[^\"]*\" ";
                return Regex.Replace(XMLString, replace, string.Empty);
            }
            /// <summary>
            /// Removes any xml tag with prefixed by an element in unWanted
            /// </summary>
            /// <param name="XMLString"></param>
            /// <param name="TagPrefix"></param>
            /// <returns></returns>
            public static string RemoveXMLAttributesFromNode(this string XMLString, List<string> unWanted)
            {
    
                foreach (string prefix in unWanted)
                {
                    //Match [Prefix][any number of Not =][=]["][any number of Not "]["][ ] <-must have space!!!
                    string replace = prefix + "[^\\=]*=\"[^\"]*\" ";
                    XMLString = Regex.Replace(XMLString, replace, string.Empty);
                }
                return XMLString;
            }
    

    Next, right before I save my string to the database, I remove the bad attributes as so:

            List<string> badAttributes = new List<string>();
            badAttributes.Add("Typography");
            var ffText = ffi.FreeFormText == null ? null : ffi.FreeFormText.RemoveXMLAttributesFromNode(badAttributes);
    

    I have not seen any issues when re-rendering the RTF after removing these attributes. Hope this solution helps someone!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have very simple form, with input like this: <input id=my_id multiple=true type=file name=image_name[]
I have very simple application just in the body of Main method. I have
I'm writing a WPF application with a RichTextBox and a Toolbar (a VERY simple
I have very simple data model like this: create table Company ( id int
I have very simple question. In my application I have some TextEdit fields. I
I'm having some trouble doing a very simple task. I have a rich textbox
I have very simple piece of code. The goal is when i input four-digit
I have very simple OpenGL ES example similar to Hehe's example : http://nehe.gamedev.net/tutorial/ios_lesson_02__first_triangle/50001/ As
I have very simple window where I have 2 buttons - one for cancel,
I have a very simple table called Member , which consists of the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.