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.