RibbonControl:中心标题
我在 UserControl 上使用 Microsoft RibbonControl(我们需要将其托管在存根表单上以在 MDI 系统中托管 WPF)。遗憾的是,功能区的标题在功能区标题中显示“顶部/左侧”,看起来很荒谬。我该如何接近那个傻瓜?
I'm using the Microsoft RibbonControl on a UserControl (it needs to be so we can host it on a stub form to host the WPF in our MDI system). Sadly, the title of the Ribbon displays Top/Left in the ribbon's header, and it looks ridiculous. How do I get at that sucker?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在正在做同样的事情。我通过使用功能区标题的数据模板解决了这个问题:
如果在 RibbonWindow 中使用功能区,您可能还想为标题文本添加发光效果,以便在将其放置在深色背景上时能够正确读取它。在这种情况下,请将此 XAML 添加到 TextBlock 中:
在 RibbonWindow 中使用 Ribbon 时,还有一个问题;当窗口状态为正常或窗口最大化时,标题文本将被正确放置。为了解决这个问题,我将 TextBlock Margin 绑定到代码绑定中的一个属性:
要使其正常工作,您还需要在每次窗口状态更改时触发 PropertyChanged 事件:
I am working on just about the same thing right now. I solved it by using a datatemplate for the ribbon title:
If the ribbon is used in a RibbonWindow, you probably also want to add a glow to the title text to be able to read it properly when placed over a dark background. In that case, add this XAML inside the TextBlock:
There is one more problem with the Ribbon when used within a RibbonWindow; the title text will either be placed correctly when window state is Normal or when window is maximized. To solve this I bound the TextBlock Margin to a property in the codebind:
To get this working, you also need to fire a PropertyChanged event each time the window state changes: