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

  • Home
  • SEARCH
  • 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 7925127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:08:57+00:00 2026-06-03T18:08:57+00:00

I am doing some localization and have bumped into a problem that I cant

  • 0

I am doing some localization and have bumped into a problem that I cant seem to figure out.

I need the following displayed: tcpCO₂ (where tcp is in italic)

<Italic>tcp</Italic> CO₂

I thought I could just put the HTML in my .resx file and all would be marry, but the content of the output shows the html including brackets etc. Does anyone have inputs in this matter?

  • 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-03T18:09:00+00:00Added an answer on June 3, 2026 at 6:09 pm

    I use an attached behavior to display rich XAML text in a TextBlock:

    public static class TextBlockBehavior
    {
        [AttachedPropertyBrowsableForType(typeof(TextBlock))]
        public static string GetRichText(TextBlock textBlock)
        {
            return (string)textBlock.GetValue(RichTextProperty);
        }
    
        public static void SetRichText(TextBlock textBlock, string value)
        {
            textBlock.SetValue(RichTextProperty, value);
        }
    
        public static readonly DependencyProperty RichTextProperty =
            DependencyProperty.RegisterAttached(
              "RichText",
              typeof(string),
              typeof(TextBlockBehavior),
              new UIPropertyMetadata(
                null,
                RichTextChanged));
    
        private static void RichTextChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            TextBlock textBlock = o as TextBlock;
            if (textBlock == null)
                return;
    
            var newValue = (string)e.NewValue;
    
            textBlock.Inlines.Clear();
            if (newValue != null)
                AddRichText(textBlock, newValue);
        }
    
        private static void AddRichText(TextBlock textBlock, string richText)
        {
            string xaml = string.Format(@"<Span>{0}</Span>", richText);
            ParserContext context = new ParserContext();
            context.XmlnsDictionary.Add(string.Empty, "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            var content = (Span)XamlReader.Parse(xaml, context);
            textBlock.Inlines.Add(content);
        }
    }
    

    You can use it like this:

    <TextBlock bhv:TextBlockBehavior.RichText="{x:Static Resources:Resource.CO2}">
    

    However, in your case don’t have access to the TextBlock directly, since it’s in the caption template of the LayoutPanel. So you need to redefine this template to apply the behavior on the TextBlock:

    <dxdo:LayoutPanel Name="PanelCo2" Caption="{x:Static Resources:Resource.CO2}">
        <dxdo:LayoutPanel.CaptionTemplate>
            <DataTemplate>
                <TextBlock bhv:TextBlockBehavior.RichText="{Binding}">
            </DataTemplate>
        </dxdo:LayoutPanel.CaptionTemplate>
    </dxdo:LayoutPanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im doing some preliminary research into the problem stated above. I have read a
While doing some small regex task I came upon this problem. I have a
Doing some R&D for my company. We are trying to have a listView that
Doing some code reviews lately I came across a number of classes that have
After doing some initial research into using Appfabric for caching, my understanding is that
Doing some jquery animation. I have certain divs set up with an attribute of
While doing some JavaScript performance tests I came up with the following piece of
While doing some refactoring I've found that I'm quite often using a pair or
After doing some search on SO, Google and MSDN forums I've become frustrated that
Localizable strings file which are used for Apple/iPhone apps localization have the following format:

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.