This is a migrated thread and some comments may be shown as answers.

Word Wrapping in the RadToggleSwitch?

2 Answers 33 Views
ToggleSwitch
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rich
Top achievements
Rank 1
Rich asked on 04 Feb 2013, 09:28 PM
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 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 07 Feb 2013, 09:51 AM
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.
0
Rich
Top achievements
Rank 1
answered on 07 Feb 2013, 11:53 AM
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!
Tags
ToggleSwitch
Asked by
Rich
Top achievements
Rank 1
Answers by
Todor
Telerik team
Rich
Top achievements
Rank 1
Share this question
or