This is a migrated thread and some comments may be shown as answers.

IsHidden binding not showing Pane

1 Answer 116 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 10 Sep 2018, 12:59 PM

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.

1 Answer, 1 is accepted

Sort by
1
Dilyan Traykov
Telerik team
answered on 13 Sep 2018, 11:15 AM
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.
Patrick
Top achievements
Rank 1
commented on 16 Mar 2022, 05:27 PM

Hello, 

I had this same problem just now and moving it to the App.xaml file did indeed help/solve the problem for me,

thank you.

Tags
Docking
Asked by
Joseph
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or