1

I want to wrap the text displayed in a radiobutton. I've tried this (derived from here) but it does not work:

    <RadioButton x:Uid="SettingsAICChains" >
        <RadioButton.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="TextWrapping" Value="WrapWholeWords" />
            </Style>
        </RadioButton.Resources>
    </RadioButton>

I have also tried to put this x:Uid in a Textblock inside the radiobutton, as explained here, but it does not work either.

I need to load the text content via x:Uid for localization reasons.

Community
  • 1
  • 1
ema3272
  • 1,021
  • 2
  • 13
  • 28
  • I don't recall `WrapWholeWords` being a member to [TextWrapping enumeration](https://msdn.microsoft.com/en-us/library/system.windows.textwrapping%28v=vs.110%29.aspx) in WPF (although it is available in UWP etc), are you maybe looking for `WrapWithOverflow` instead? – Chris W. Mar 09 '16 at 16:08
  • I am developing a UWP application, sorry for the WPF tag... – ema3272 Mar 09 '16 at 16:29
  • Do you have it set to `preserve` space by chance? – Chris W. Mar 09 '16 at 16:42
  • not intentionally. Where should I check this `preserve` attribute? – ema3272 Mar 09 '16 at 16:46
  • On your resource string(s) are you doing like ``? – Chris W. Mar 09 '16 at 16:49
  • Yes. I can see in wordpad that all my strings are defined that way. – ema3272 Mar 09 '16 at 16:53
  • Ditch `xml:space="preserve"` and give it a shot. – Chris W. Mar 09 '16 at 16:54
  • I have deleted it from all resource files. No change... – ema3272 Mar 09 '16 at 17:06
  • Hmmm, I'm obviously missing something here. So you have some sort of boundary to invoke the wrapping set, be it MaxWidth or caused by the parent right? The string is greater than 120px width (since the uwp RB has a minwidth set of 120 as the default)? And there's nothing else that could be forcing it to preserve the length of the string? If it comes to it, you could replace the `ContentPresenter` in the template with `TextBlock` using Text="{TemplateBinding Content}" TextWrapping="Wrap" and that should do it, but it almost sounds like we'd need to see more of the instance use to troubleshoot. – Chris W. Mar 09 '16 at 17:11

1 Answers1

0

Checkout the TextTrimming property and MaxHeight property. These would help.

Chirag Shah
  • 981
  • 1
  • 6
  • 12
  • MaxHeight = infinity. Text is not trimmed, just truncated at the end of the first and single line – ema3272 Mar 13 '16 at 10:20