ExpanderStyle doesn't apply to RadPanelBar

3 posts, 0 answers
  1. Manuel
    Manuel avatar
    5 posts
    Member since:
    Oct 2011

    Posted 25 Oct 2011 Link to this post

    Hello,
    I hope I haven't overlooked a thread or support-page. I'm using the RadPanelBar with the help of a Binding (see code below) to a dictionary.
    All works fine, I see my items and my childs. But now I'm trying to remove the arrow (expander) from the Header-elements. I already tried the ExpanderStyle-Property and set it Opacity to 0 (like I saw in an example related to a TreeView) but nothing changes and it seems, that the ExpanderStyle-Property isn't applied in any way.

    What is my mistake?

    <telerik:RadPanelBar Height="100" Width="300" x:Name="RadPanelMenu" ExpandMode="Single" ItemsSource="{Binding MenuItems}">
        <telerik:RadPanelBar.ExpanderStyle>
            <Style TargetType="ToggleButton">
                <Setter Property="Opacity" Value="0"/>
            </Style>
        </telerik:RadPanelBar.ExpanderStyle>
        <telerik:RadPanelBar.ItemTemplate>
            <telerik:HierarchicalDataTemplate ItemsSource="{Binding Path=Value}">
                <telerik:HierarchicalDataTemplate.ItemTemplate>
                    <DataTemplate>
                        <HyperlinkButton NavigateUri="{Binding Path=Target}" Command="{Binding Path=Command}" Content="{Binding Path=Image}" Tag="{Binding Path=Title}" Style="{StaticResource ParentMenuItemStyle}"/>
                    </DataTemplate>
                </telerik:HierarchicalDataTemplate.ItemTemplate>
                <HyperlinkButton NavigateUri="{Binding Path=Key.Target}" Command="{Binding Path=Key.Command}" Content="{Binding Path=Key.Image}" Tag="{Binding Path=Key.Title}" Style="{StaticResource ParentMenuItemStyle}"/>
            </telerik:HierarchicalDataTemplate>
        </telerik:RadPanelBar.ItemTemplate>
    </telerik:RadPanelBar>

    Additionally I want to change later on the background and much more of the styling, so I guess it would be a good solution to edit the template and directly removes the arrows? I already tried something with that but than my DataTemplate (see above) wasn't used anymore...

    So how could the expander easily removed and the Header- and Children-backgrouns easily changed?
     
    Thank you very much in advance!
  2. Manuel
    Manuel avatar
    5 posts
    Member since:
    Oct 2011

    Posted 26 Oct 2011 Link to this post

    Okay I solved this issue now with redefining the Template and ChildItemsTemplate (see code below) of RadPanelBarItem. So I could easily remove the arrow and also define the background etc.
    I didn't know, that you can assign a DataTemplate to a ContentPresenter, which was important for displaying the data correctly.

    The default templates can be seen here: http://www.telerik.com/help/silverlight/radpanelbar-required-template-parts.html
    So based on them you can easily adjust the styling.

    <Style TargetType="telerik:RadPanelBarItem">
        <Setter Property="Template" Value="{StaticResource PanelBarItemTopLevelTemplate}" />
        <Setter Property="ChildItemsTemplate" Value="{StaticResource PanelBarItemSecondLevelTemplate}" />
    </Style>

    Just for people with similiar problems ;).
  3. DevCraft banner
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 28 Oct 2011 Link to this post

    Hi Manuel,

     We're glad to hear that you have solved this. We just wanted to mention that the ExpanderStyle cannot be used in RadPanelBar. This property is inherited from RadTreeView but it is never used in PanelBar. Please excuse us for any inconvenience caused.

    All the best,
    Petar Mladenov
    the Telerik team

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

Back to Top