wpf - 如何使 WPF RibbonWindow 的标题居中?

标签 wpf ribbon

我想将我的 RibbonWindow 的标题居中,而不是在侧面对齐。

这个线程说它有一个答案: Center WPF RibbonWindow Title via XAML Code

但是没用。

下面是一张图片和对应的代码。

title not centered

    <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/

相关文章:

c# - 使用 TreeView 的主视图/详细 View

c# - 功能区控件专注于按钮单击

java - 功能区可以在没有菜单栏的 Mac 中使用吗?

wpf - 如何设置 RibbonSplitButton ItemTemplate 的样式

c# - Blend (XAML) 不支持我在 Image.Source 中的 png 图像

资源的 C# Uri 生成器

WPF 隐藏顶部面板布局

wpf - XAML 文本框在焦点上更改边框颜色

python - 如何将shell脚本添加到word功能区栏?

c# - 如何在功能区窗口 wpf C# 中显示状态栏