我想在我的应用程序中使用自定义的 Pivot 控件。我需要它与我在警报应用程序中看到的完全一样,我从中添加了屏幕截图,如下所示:
- 我想要带有图标和文本的标签
- 每个选项卡在被选中时都应该改变颜色
我将如何实现这一点?
最佳答案
基本上,您应该为此使用标准的枢轴控件——但不要将文本放入您自己的用户控件或分组到标题内容中。
<Pivot Style="{StaticResource TabsStylePivotStyle}">
<PivotItem>
<PivotItem.Header>
<local:TabHeader Label="item 1" Glyph="" />
</PivotItem.Header>
<TextBlock Text="Content content content" />
</PivotItem>
<PivotItem>
<PivotItem.Header>
<local:TabHeader Label="item 2" Glyph="" />
</PivotItem.Header>
<TextBlock Text="Content content content" />
</PivotItem>
<PivotItem>
<PivotItem.Header>
<local:TabHeader Label="item 3" Glyph="" />
</PivotItem.Header>
<TextBlock Text="Content content content" />
</PivotItem>
这里是 an official code sample (注意场景3)。
关于c# - 如何在 UWP 中创建 Tab Header Pivot 控件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37684883/