gpt4 book ai didi

uwp - 如何在 UWP 中的 ToggleSwitch 的 Header 字段中包装文本

转载 作者:行者123 更新时间:2023-12-03 21:28:30 24 4
gpt4 key购买 nike

我在 UWP 应用程序的设置页面上有一个 ToggleSwitch,我注意到 ToggleSwitch 的标题文本无法包装它。当我在电话模拟器中测试该应用程序时,Header 会直接离开页面。知道如何像使用 TextBlock 一样使文本换行吗?

<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:

        <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>

关于uwp - 如何在 UWP 中的 ToggleSwitch 的 Header 字段中包装文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42568961/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com