Setting HeaderBackgroundVisual through a xaml style

2 posts, 0 answers
  1. Masoud
    Masoud avatar
    61 posts
    Member since:
    Aug 2011

    Posted 20 Apr 2012 Link to this post

    Hi there,

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


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

    Thank you for your effort!
  2. Dani
    Dani avatar
    848 posts

    Posted 25 Apr 2012 Link to this post

    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.

    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top