工具提示中的长文本未在 UWP 中完全显示
Long text in tooltip is not fully shown in UWP
我已经为列表框项定义了一个,并将工具提示中的文本绑定到对象的两个属性(名称 + 描述),但我遇到了文本被截断的问题
这是我的工具提示:
<ToolTipService.ToolTip>
<StackPanel >
<StackPanel Orientation="Vertical">
<TextBlock FontSize="13">
<Bold>Name</Bold>
</TextBlock>
<TextBlock Text="{x:Bind name}"/>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock FontSize="13" TextWrapping="Wrap">
<Bold>Description</Bold>
</TextBlock>
<TextBlock Text="{x:Bind description}"/>
</StackPanel>
</StackPanel>
</ToolTipService.ToolTip>
现在的问题是,如果我将工具提示绑定到 returns 名称 + 描述的方法(以前是这样,但非常丑陋)它会显示所有文本,它是像这样:
<ToolTipService.ToolTip>
<TextBlock Text="{x:Bind Description}"/>
</ToolTipService.ToolTip>
但我需要对其进行样式设置以使其看起来更好,所以我尝试按照上面发布的内容进行操作。
我已经尝试将 Width/Height 设置为超大值,但没有做任何事情。
有什么想法吗?
工具提示模板可能有一个默认的最大宽度,它会截断 TextBlock
。要解决这个问题,只需添加 TextWrapping
属性:
<TextBlock TextWrapping="Wrap" Text="{x:Bind description}"/>
现在工具提示文本将根据需要换行
我已经为列表框项定义了一个,并将工具提示中的文本绑定到对象的两个属性(名称 + 描述),但我遇到了文本被截断的问题
这是我的工具提示:
<ToolTipService.ToolTip>
<StackPanel >
<StackPanel Orientation="Vertical">
<TextBlock FontSize="13">
<Bold>Name</Bold>
</TextBlock>
<TextBlock Text="{x:Bind name}"/>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock FontSize="13" TextWrapping="Wrap">
<Bold>Description</Bold>
</TextBlock>
<TextBlock Text="{x:Bind description}"/>
</StackPanel>
</StackPanel>
</ToolTipService.ToolTip>
现在的问题是,如果我将工具提示绑定到 returns 名称 + 描述的方法(以前是这样,但非常丑陋)它会显示所有文本,它是像这样:
<ToolTipService.ToolTip>
<TextBlock Text="{x:Bind Description}"/>
</ToolTipService.ToolTip>
但我需要对其进行样式设置以使其看起来更好,所以我尝试按照上面发布的内容进行操作。 我已经尝试将 Width/Height 设置为超大值,但没有做任何事情。 有什么想法吗?
工具提示模板可能有一个默认的最大宽度,它会截断 TextBlock
。要解决这个问题,只需添加 TextWrapping
属性:
<TextBlock TextWrapping="Wrap" Text="{x:Bind description}"/>
现在工具提示文本将根据需要换行