2014-12-05 71 views
2

我有一些XAML:我可以在WPF中包装RadioButton的内容/文本值吗?

<StackPanel Orientation="Horizontal"> 
    <TextBlock x:Name="KeyLWP" TextWrapping="Wrap" MaxWidth="120">A Letter or Word or Phrase 
    </TextBlock> 
    <StackPanel> 
     <RadioButton x:Name="rdbtnCandidateVal1" Content="Two wrongs don't make a Wright Brothers Grimm was the Thingamabob Dylan Thomas Jefferson Airplane"> 
     </RadioButton> 

...其中,分配给一个单选按钮的内容的长字符串,它只是脱落的地球的边缘。如果需要,我如何使用TextBlock的TextWrapping和MaxWidth属性来包装它?或者我必须将TextBlock与每个RadioButton配对,避开RadioButton的Content/Text属性?

回答

3

你有一些选择,你可以在单选按钮样式模板中使它做到这一点,所以它适用于所有这些,或者在实例级别只是一个快速;

<RadioButton> 
    <RadioButton.Content> 
     <TextBlock Text="Wrap My Content Pretty Pretty Please" TextWrapping="Wrap"/> 
    </RadioButton.Content> 
</RadioButton> 

或者还有其他的选择,让我知道如果有一个特定的场景,我们会得到亚排序。

+0

谢谢,克里斯;我不得不添加一个MaxWidth val,但这很简单。 – 2014-12-06 00:16:13

相关问题