RadMenu background color

5 posts, 1 answers
  1. Hunter
    Hunter avatar
    11 posts
    Member since:
    Feb 2012

    Posted 27 Apr 2012 Link to this post

    I have a RadMenu two levels deep. I need to change the gray background color of the second level so the white text will be more visible against it (see attached screenshot). I have attempted to do this with the ItemContainerStyle, but something isn't working.

    <telerik:RadMenu HorizontalAlignment="Stretch" Name="radMenu1" ItemContainerStyle="{StaticResource MenuItemStyle}" ItemsSource="{Binding TreeNode}" ItemClick="radMenu1_ItemClick" IconColumnWidth="0" Height="30" Foreground="White" Background="Transparent" FontSize="12" FontWeight="Bold" telerik:StyleManager.Theme="Vista">
        <telerik:RadMenu.ItemTemplate>
            <telerik:HierarchicalDataTemplate ItemsSource="{Binding Children}">
                <TextBlock Text="{Binding Value.Title}" />
            </telerik:HierarchicalDataTemplate>
        </telerik:RadMenu.ItemTemplate>
    </telerik:RadMenu>

    And here is the MenuItemStyle (I'm setting additional fields just to see if I can get something to change):

    <Style x:Key="MenuItemStyle" TargetType="telerik:RadMenuItem">
        <Setter Property="Background" Value="red"/>
        <Setter Property="Foreground" Value="red"/>
        <Setter Property="FontSize" Value="20"/>
        <Setter Property="Height" Value="60" />
    </Style>

    This is having no visible effect. Any ideas?
  2. Answer
    Dani
    Admin
    Dani avatar
    848 posts

    Posted 30 Apr 2012 Link to this post

    Hi Hunter,

    Basic Style Setters in the ItemContainerStyle will change properties of the menu items, but what you wish to change is actually not the background of the menu item itself. It is the background of the Popup inside the RadMenuItem. For this you need the template.

    You can generate the entire ItemContainerStyle from Expression Blend, find the TopLevelHeaderTemplate and change the background of the Popup. That background is determined by a Border and a Rectangle inside the Popup.

    Hope this helps.

    Kind regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
  4. Hunter
    Hunter avatar
    11 posts
    Member since:
    Feb 2012

    Posted 30 Apr 2012 Link to this post

    Thanks, Dani. It turns out that we're going to go in a different direction, but your answer will be helpful for future reference.
  5. Kevin
    Kevin avatar
    31 posts
    Member since:
    Jan 2009

    Posted 02 May 2012 Link to this post

    If you want to style a certain theme in Expression for a RadMenu how would you do that?  By default when I add a control it comes with the Office_Black styling.
  6. Dani
    Admin
    Dani avatar
    848 posts

    Posted 03 May 2012 Link to this post

    Hello Kevin,

    Currently it is not possible to generate a theme other than the default Office Black theme in Expression Blend. In case you wish to edit another theme, you will have to manually copy the xaml from your local RadControls installation folder into your project.

    A short description of the latest folders distributed with the installation as well as some useful details on the implicit styles and how to use them, can be found here.

    I hope this helps.

    Kind regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top
DevCraft banner