设计器中的 WPF 功能区选项卡视图
我正在使用“Microsoft Ribbon for WPF”并创建多个 RibbonTab。我无法找出在设计器中查看/聚焦不同选项卡的方法,并且它默认显示“主页”选项卡。要查看我对“Home”选项卡以外的选项卡所做的设计/xaml 更改,我必须每次都调试项目并单击选项卡,这不是很方便。或者我可以命令出我想要忽略的选项卡 xaml。那里有人有解决方案吗?
I'm using "Microsoft Ribbon for WPF" and creating multiple RibbonTab. I cannot figure out a way to view/focus different tabs in the designer and it by default show the "Home" tab. To see design/xaml changes I made to tabs other than the "Home" tab, I have to debug the project every time and click through the tabs, which is not very convenient. Or I can command out the tab xaml I want to to ignore. Anyone body out there has a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还可以使用功能区上的 SelectedIndex 属性来设置哪个选项卡是当前选定的选项卡(0 是第一个选项卡,1 是第二个选项卡,等等)
You can also use the SelectedIndex property on the Ribbon to set which tab is the currently selected tab (0 being the first tab, 1 being the second, etc.)
我发现的唯一方法是将 Selector.IsSelected 属性设置为 true。这将导致该选项卡在设计时变得可见。
The only way I have found is to set the Selector.IsSelected property to true. This will cause the tab to become visible at design time.
我现在无法确认这是否有效,因为我的预览通常无法正常工作,但是当仅在设计时尝试隐藏某些内容时,这通常在 WPF 中有效。
包含混合的命名空间
然后在要隐藏的元素中使用
d:IsHidden="True"
。这只会影响设计时间,从而消除了在构建之前忘记将所选索引更改为正确值的问题。I can't confirm this is working right now because my preview in general is not working properly, but this works in general in WPF when trying to hide something at design time only.
Include the namespace for blend
Then in the element you want to hide use
d:IsHidden="True"
. This will only affect design time, which eliminates the problem of forgetting to change the selected index to the correct value before building.