我想将我的 RibbonWindow 的标题居中,而不是在侧面对齐。
这个线程说它有一个答案: Center WPF RibbonWindow Title via XAML Code
但是没用。
下面是一张图片和对应的代码。
<RibbonWindow x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Ribbon>
<Ribbon.TitleTemplate>
<DataTemplate>
<TextBlock TextAlignment="Center" HorizontalAlignment="Stretch" Width="{Binding ElementName=Window, Path=ActualWidth}">ApplicationTitle
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="0" Color="MintCream " BlurRadius="10" />
</TextBlock.Effect>
</TextBlock>
</DataTemplate>
</Ribbon.TitleTemplate>
</Ribbon>
</Grid>
</RibbonWindow>
我正在使用 VS 2012、.NET 4.5 和包含的 System.Windows.Controls.Ribbon 程序集。
最佳答案
在使用 WPF 的 RibbonControlsLibrary 时有过糟糕的经历。它不仅在标题居中方面存在问题。它还打破了顶部的窗口圆角,图标和标题在最大化时从屏幕上消失,我个人还没有找到任何机会来编写功能区组对话框。所有这些让我开始寻找替代品,我找到了 Fluent Ribbon Controls Suite
下载源代码并为 .NET 4.5 构建它(我完全没有问题地做到了)。
关于wpf - 如何使 WPF RibbonWindow 的标题居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12959412/