Word Wrapping in the RadToggleSwitch?

3 posts, 0 answers
  1. Rich
    Rich avatar
    8 posts
    Member since:
    Jul 2011

    Posted 04 Feb 2013 Link to this post

    I'm sure there's a simple way to do this, but I'm rather a novice, almost completely self-taught, so whatever the way, I'm not aware of it...  Is there a simple way to wrap the text in the Content property of a RadToggleSwitch?  Here's the scenario...

    Right now the Content property is bound to a strings resource (for localization).  The string changes with position of the switch.  I would like to enable TextWrapping so that in languages that take more space than English, I won't be running out of room.  Here's what it looks like now:

    <telerikPrimitives:RadToggleSwitch
      Content="{Binding UseLiveTile,
        Source={StaticResource Settings},
        Converter={StaticResource liveTileConverter}}"
      IsChecked="{Binding UseLiveTile,
        Source={StaticResource Settings},
        Mode=TwoWay}" />

    The liveTileConverter just switches between two strings depending on the bool of IsChecked.  Like I said, all I want is to be able to wrap in case the text goes longer than the space needed in English.

    Thanks,
    Rich
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 07 Feb 2013 Link to this post

    Hi Rich,

    Thank you for contacting us.

    Yes, there is more simple way for displaying text in more that one row. You just need to define a ContentTemplate with TextBlock which allows wrapping:

    <telerikPrimitives:RadToggleSwitch Content="This is toggle switch. And the text for Content is too long.">
        <telerikPrimitives:RadToggleSwitch.ContentTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding}" TextWrapping="Wrap"/>
            </DataTemplate>
        </telerikPrimitives:RadToggleSwitch.ContentTemplate>
    </telerikPrimitives:RadToggleSwitch>

    I hope this information helps.

    All the best,
    Todor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Rich
    Rich avatar
    8 posts
    Member since:
    Jul 2011

    Posted 07 Feb 2013 Link to this post

    Wow, that was simple.  Didn't have to change any of the existing code, just add this to it.  How cool is that??
    Thanks, Todor!
Back to Top