This is a migrated thread and some comments may be shown as answers.

Setting HeaderBackgroundVisual through a xaml style

1 Answer 40 Views
Window
This is a migrated thread and some comments may be shown as answers.
Masoud
Top achievements
Rank 1
Masoud asked on 20 Apr 2012, 03:14 PM
Hi there,

Until Q1 2012 I used the following properties to style the background color of the header of the RadWindow.  

    Background="Black"
    BorderBackground="Black"
    BorderBrush="Black"

Starting with Q1 2012 Setting these values no longer sets the background color of the RadWindow.  

I digged through the ControlTemplate and found out that appearance of the header of RadWindow is controlled through the Fill of the recangle HeaderBackgroundVisual,   

Is it possible to create a style that inherits from RadWindowStyle that changes the Fill of HeaderBackgroundVisual?  Something like this?
<Style x:Key="RadWindowWithBlackHeader" TargetType="RadWindow" BasedOn="{StaticResource TextBlockStyle}">
    <Setter Property="HeaderBackgroundVisual.Fill" Value="Black" />
</Style>

 
Thank you for your effort!

1 Answer, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 25 Apr 2012, 09:01 AM
Hi Klaus,

Please, correct me if I misunderstood this, but you cannot set the window header background through Border and Background properties on RadWindow in version prior to 2012 Q1 or after. What changes is the border of the RadWindow and the fill of that border. In fact, if you wish to customize the window header, you will need to do that by generating and modifying the RadWindowStyle.

The xaml you are suggesting will unfortunately not work, because the HeaderBackgroundVisual is just a name of an element in the control template of RadWindow and not a property of RadWindow. You will not be able to target that particular rectangle unless you add the whole window template in your project.

Once you do that, you can simply change the WindowHeaderBackground brush to give the window header a different background.

Hope this helps.

Regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Window
Asked by
Masoud
Top achievements
Rank 1
Answers by
Dani
Telerik team
Share this question
or