locked
How to create simple control that inherits from TextBlock RRS feed

  • Question

  • Hi,

    I need to create TextBlock control which has two Text properties: FullText and ShortText.
    It should normally show FullText, and when FullText doesn't fit textblock's size, it should show ShortText.

    On Android I inherited TextView element and added just one line of code to achieve this.

    Is there a way to create such control as simple as on android, but for WinRT?

    I consider following options:

    1. Converter - but I don't know how to pass element reference to converter (to get info about typeface, textsize etc.) and converter wouldn't update control after its size changed.
    2. Custom control with one TextBlock in its template - in this scenario I can't apply TextBlock style to my custom control
    3. Inherit TextBox

    • Edited by tlaguz Saturday, April 18, 2015 7:24 AM
    Saturday, April 18, 2015 7:24 AM