WPF 选项卡控制标题之间的间距
WPF Tabcontrol 的默认行为是将选项卡标题彼此相邻放置,之间没有任何空白。如果我想指定标题之间的间隙怎么办?我必须为此定义一个控制模板吗?我对粮食计划署比较陌生,非常感谢任何帮助。
谢谢
The default behavior of the WPF Tabcontrol is to place the Tab Headers adjacent to each other, without any empty space in between. What if I wanted to specify a gap between the headers? Do I have to define a control template for this? I'm relatively new to WFP and any help is appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信您需要为 TabItem 定义一个自定义控件模板,甚至可能为 TabControl 定义一个自定义控件模板。下面是一个使用间隔符进行分隔的 TabItem 示例。
希望这是朝着正确方向的推动;您仍然需要将其添加为样式资源并从 TabControl -> 引用它选项卡项。
I believe you will need to define a custom control template for the TabItem, maybe even one for the TabControl. Here is an example of a TabItem that uses a spacer for some separation.
Hopefully that is a nudge in the right direction; you will still need to add that as a style resource and reference it from your TabControl -> TabItem.
通过在设计器中添加空间很容易。从最右边的选项卡开始,选择要移动的选项卡。然后按住 ctrl 并使用右箭头键将选项卡向右移动。对其余选项卡执行相同操作。然后你可以在xaml代码中手动调整边距。
It is easy to add space by doing it in the designer. Select the Tab you want to move, by starting with the rightmost tab. Then hold ctrl and use the right arrow key to move the tab to the right. Do the same with the rest of the tabs. Then you can manually adjust the margin in the xaml code.