IsHidden binding not showing Pane

2 posts, 0 answers
  1. Joseph
    Joseph avatar
    1 posts
    Member since:
    Sep 2018

    Posted 10 Sep 2018 Link to this post

    I'm setting the style of my RadPane just like the 'VisualStudio' example:

    <Style TargetType="telerik:RadPane" BasedOn="{StaticResource RadPaneStyle}">
        <Setter Property="CanDockInDocumentHost" Value="False" />
        <Setter Property="Header" Value="{Binding Header}" />
        <Setter Property="IsHidden" Value="{Binding IsHidden, Mode=TwoWay}" />
    </Style>
     
    <Style TargetType="telerik:RadDocumentPane" BasedOn="{StaticResource RadPaneStyle}">
        <Setter Property="Header" Value="{Binding Header}" />
        <Setter Property="IsHidden" Value="{Binding IsHidden, Mode=TwoWay}" />
    </Style>

     

    My ViewModel has the IsHidden property, and is notifying fine. Removing the panels works. However, 'unhiding' them fails.

    protected override RadPane CreatePaneForItem(object item)
    {
        var viewModel = item as IDockPane;
        if (viewModel == null) return base.CreatePaneForItem(item);
     
        var pane = viewModel.PaneType == PaneType.DocumentPane ? new RadDocumentPane() : new RadPane();
        pane.DataContext = item;
        RadDocking.SetSerializationTag(pane, viewModel.Header);
     
        pane.Content = new TextBlock { Text = "Test" };
     
        return pane;
    }

     

    After some searching these forums, it seems an issue with the binding not updating because it's removed from the visual tree? If so, is there any alternatives? How is the Visual Studio example getting around this? I can find no other code that attempts to restore the hidden panes - but maybe I'm missing it.

    I tried simply listening for the IsHidden property change:

    viewModel.PropertyChanged += (sender, args) =>
    {
        pane.IsHidden = viewModel.IsHidden;
    };

     

    And this half works. The first time it does nothing, but the second time you 'cycle' the IsHidden property (say with a checkbox) it appears again! Except the tabs are missing their headers.

    The DataContext is set fine, and if I go in and press 'reset' on the binding in the Visual Studio live property editor it refreshes just fine to the right header.

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1075 posts

    Posted 13 Sep 2018 Link to this post

    Hello Joseph,

    Could you please specify where you've defined the implicit style for the RadPane? If the definition is not located in the App.xaml file, could you please try moving it there and see if the issue is resolved?

    If you have in fact placed the style in the App.xaml file, may I kindly ask you to open a new support ticket and send over a small sample project demonstrating your setup so that I can further investigate and assist you?

    I look forward to your reply.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top