如何在UWP中的ToggleSwitch标题字段中包装文本
我在UWP应用程序的设置页面上有一个ToggleSwitch,我注意到ToggleSwitch的标题文本没有一种方式来包装它。当我在phone emulator中测试应用程序时,标题会直接从页面上消失。你知道我怎样才能像你一样用文本块把文本包装起来吗如何在UWP中的ToggleSwitch标题字段中包装文本,uwp,responsive,togglebutton,word-wrap,Uwp,Responsive,Togglebutton,Word Wrap,我在UWP应用程序的设置页面上有一个ToggleSwitch,我注意到ToggleSwitch的标题文本没有一种方式来包装它。当我在phone emulator中测试应用程序时,标题会直接从页面上消失。你知道我怎样才能像你一样用文本块把文本包装起来吗 <StackPanel Margin="10,0"> <ToggleSwitch Name="toggleOne" Header="Check this on if you want the app to automati
<StackPanel Margin="10,0">
<ToggleSwitch Name="toggleOne" Header="Check this on if you want the app to automatically trigger the zombie apocalypse" Margin="10" />
<ToggleSwitch Name="toggleTwo" Header="Short Sample Text" Margin="10" />
</StackPanel>
您可以为切换开关添加一个
HeaderTemplate
,如下所示:
<ToggleSwitch
Name="toggleOne"
Margin="10"
Header="Check this on if you want the app to automatically trigger the zombie apocalypse">
<ToggleSwitch.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" TextWrapping="Wrap" />
</DataTemplate>
</ToggleSwitch.HeaderTemplate>
</ToggleSwitch>