【问题标题】:Place the Content Text at the center inside the teaching tip将内容文本置于教学提示内的中心
【发布时间】:2020-10-29 23:12:15
【问题描述】:

我在 UWP 中使用 WinUi 2.4 的教学提示控件,我想将内容放在教学提示的中心。但是我无法将内容放置在中心。我没有提供任何标题,副标题。请找到附加的图像。我可以让关闭图标不可见吗?

<winui:TeachingTip x:Name="ToggleThemeTeachingTip2"
                    IsOpen="True"                        
                    PreferredPlacement="Bottom"
                    PlacementMargin="30"                                 
                    Background="Green" Foreground="White"  
                                   
                    >
                    <winui:TeachingTip.Content>
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center"   Text="Content of the teaching tip"></TextBlock>
                    </winui:TeachingTip.Content>
                </winui:TeachingTip>
                

【问题讨论】:

  • 你好,这个是由TeachingTip控件模板的样式决定的,TeachingTip给顶部留了一定的空间。可以看到TeachingTiphere的完整模板定义。

标签: uwp alignment winui


【解决方案1】:

这不是最干净的解决方案,但不会花费太多精力并且效果很好。只需向内容元素添加负边距(在您的情况下为TextBlock):

<TextBlock Margin="0,-40,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"   Text="Content of the teaching tip"></TextBlock>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-20
    • 1970-01-01
    • 1970-01-01
    • 2018-05-15
    • 1970-01-01
    相关资源
    最近更新 更多