TextPrimitive doesn't size properly if it contains "&&" characters.

2 posts, 1 answers
  1. Michael
    Michael avatar
    33 posts
    Member since:
    Mar 2009

    Posted 21 Apr 2009 Link to this post

    By default TextPrimitive renders the '&' character as an underscore on the following character, like a menu hotkey.  I need to actually display an ampersand on the screen.  I found that if I double the character ("&&"), the TextPrimitive displays the ampersand.  However, it no longer sizes properly to the text it contains.  I'm wondering if the TextPrimitive sizing code thinks the ampersands will cause underlines even though the rendering code draws an ampersand.
  2. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 22 Apr 2009 Link to this post

    Hello Michael,

    Thank you for writing.

    I have managed to reproduce the described behavior. There is an issue with the text measure when you are trying to escape ampersand character. We are currently researching this in detail. If you do not want to use shortcuts binding you could avoid this behavior by setting UseMnemonic property of TextPrimitive to false:

    TextPrimitive.UseMnemonic = false;  

    Please, excuse us for the inconvenience. Don't hesitate to contact us if you have other questions.

    Greetings,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top