PanelBarItem and Visibility.Collapsed

3 posts, 1 answers
  1. Jacob
    Jacob avatar
    7 posts
    Member since:
    Sep 2010

    Posted 29 Oct 2010 Link to this post

    Hello all,

    I'm playing with the Silverlight demo controls, particularly the RadPanelBar. I want to be able to hide RadPanelBarItems, but when an expanded PanelBarItem's Visibility is set to Collapsed, that PanelBarItem still takes up space. I'd expect that PanelBarItem to no longer be included in layout, per the MSDN description.

    A very simple repro case is below. When I view this control in my browser, I expect the two visible PanelBarItems to be displayed at the top of the PanelBar. Instead, they are displayed at the bottom, as if the collapsed PanelBarItem is still there. Is this expected behavior?

    <UserControl
        mc:Ignorable="d"
        x:Class="SilverlightApplication1.PanelBar"
        d:DesignWidth="640" d:DesignHeight="480">
     
        <Grid x:Name="LayoutRoot" Background="White">
            <telerik:RadPanelBar VerticalAlignment="Stretch">
                <telerik:RadPanelBarItem Header="RadTreeViewItem" IsExpanded="True" Visibility="Collapsed">
                    <telerik:RadPanelBarItem Header="RadTreeViewItem"/>
                </telerik:RadPanelBarItem>
                <telerik:RadPanelBarItem Header="RadTreeViewItem">
                    <telerik:RadPanelBarItem Header="RadTreeViewItem"/>
                </telerik:RadPanelBarItem>
                <telerik:RadPanelBarItem Header="RadTreeViewItem">
                    <telerik:RadPanelBarItem Header="RadTreeViewItem"/>
                </telerik:RadPanelBarItem>
            </telerik:RadPanelBar>
        </Grid>
    </UserControl>

    Thanks,
    Jacob Champion
  2. Answer
    Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 03 Nov 2010 Link to this post

    Hi Jacob,

     This is know issue with the RadTreeView, but since the RadPanelBar inherits from it - it gets it as well. The problem is caused by the default virtualizing panel, but you can fix it pretty easily by changing the ItemsPanel

    <ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
            <StackPanel/>
        </ItemsPanelTemplate>
     
    <telerik:RadPanelBar VerticalAlignment="Stretch" ItemsPanel="{StaticResource ItemsPanelTemplate1}">

    Hope this will help you.

    All the best,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Jacob
    Jacob avatar
    7 posts
    Member since:
    Sep 2010

    Posted 03 Nov 2010 Link to this post

    Miro,

    That's exactly the behavior I was looking for. Thank you!

    Jacob Champion
Back to Top