开发者

How can I change the color of a (Telerik) RadRibbonBar's title text?

I've declared a Telerik RadRibbonBar in my application, but the title window's text is white, and looks like this:

How can I change the color of a (Telerik) RadRibbonBar's title text?

In my opinion, it looks pretty bad. Does anyone know of any way to change it? This is the XAML I'm using:

<telerikRibbon:RadRibbonWindow x:Class="TestApp.MainWindow"                   
                               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"                   
                               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"                   
                               xmlns:telerik="clr-namespace:Telerik开发者_运维百科.Windows.Controls;assembly=Telerik.Windows.Controls"                   
                               xmlns:telerikRibbon="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"                                                 
                               Height="300" Width="300">
    <DockPanel LastChildFill="True">
        <telerikRibbon:RadRibbonBar ApplicationName="This text is white and looks awful." DockPanel.Dock="Top" Focusable="False">
            <telerikRibbon:RadRibbonBar.ApplicationMenu>
                <telerikRibbon:ApplicationMenu>
                    <telerikRibbon:RadRibbonButton Text="New"/>
                </telerikRibbon:ApplicationMenu>
            </telerikRibbon:RadRibbonBar.ApplicationMenu>

            <telerikRibbon:RadRibbonTab Header="Home">

            </telerikRibbon:RadRibbonTab>
        </telerikRibbon:RadRibbonBar>

        <Grid DockPanel.Dock="Bottom" Background="White">
        </Grid>
    </DockPanel>
</telerikRibbon:RadRibbonWindow>


What you'll want to do is extract the template for RadRibbonBar to make a slight modification to a few Foreground properties. Once extracted, look for:

PART_ActualWindowTitle

Which covers the Title you're seeing. Under that search for the section with three textblocks (Title, Divider, ApplicationName) and change the XAML to something like this:

<StackPanel Orientation="Horizontal">
<TextBlock x:Name="Title" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Title}"/>
<TextBlock x:Name="Divider"
            Foreground="{TemplateBinding Foreground}" telerik:LocalizationManager.ResourceKey="RibbonBarWindowTitleDivider" Text=" - "><Run Text=" - "/></TextBlock>
<TextBlock x:Name="ApplicationName"
            Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding ApplicationName}"/>

Which will allow you to set your <telerik:RadRibbonBar Foreground="ColorYouWant" /> and that will be reflected in the Title bar. You can of course switch this to use a hard coded value, a resource from somewhere else in your app, etc., but this is the area you'll want to work with to have an impact on the application title.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜