Hello,
I am using XamDockManager this way:
<igDm:XamDockManager Name="DockManager" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <i:Interaction.Triggers> <i:EventTrigger EventName="Loaded"> <i:InvokeCommandAction Command="{Binding Path=LoadLayoutSettingsCommand}" CommandParameter="{Binding ElementName=DockManager}" /> </i:EventTrigger> <i:EventTrigger EventName="LayoutUpdated"> <i:InvokeCommandAction Command="{Binding Path=SaveLayoutSettingsCommand}" CommandParameter="{Binding ElementName=DockManager}" /> </i:EventTrigger> </i:Interaction.Triggers> <igDm:SplitPane> <igDm:ContentPane Header="MainContent" SaveInLayout="False" TabHeader="{x:Null}" Style="{StaticResource ContentPaneStyle}"> <!-- CONTENT --> </igDm:ContentPane> </igDm:SplitPane> <igDm:XamDockManager.Panes> <igDm:SplitPane igDm:XamDockManager.InitialLocation="DockedRight" SplitterOrientation="Vertical" Width="300"> <igDm:TabGroupPane TabStripPlacement="Bottom"> <igDm:ContentPane x:Name="ToolsPane" Header="Tools" SaveInLayout="True" Visibility="{Binding Path=ToolsPaneVisibility}" Style="{StaticResource ContentPaneStyle}"> <Binding Path="ActiveToolsPaneView"/> </igDm:ContentPane> <igDm:ContentPane x:Name="PropertiesPane" Header="Properties" SaveInLayout="True" Visibility="{Binding Path=PropertiesPaneVisibility}" Style="{StaticResource ContentPaneStyle}"> <Binding Path="ActivePropertiesPaneView"/> </igDm:ContentPane> </igDm:TabGroupPane> </igDm:SplitPane> </igDm:XamDockManager.Panes> </igDm:XamDockManager>
I thought <igDm:ContentPane x:Name="PropertiesPane" Header="Properties" SaveInLayout="True" Visibility="{Binding Path=PropertiesPaneVisibility}" Style="{StaticResource ContentPaneStyle}"> would set the visibility, but obviously the visibility is set somewhere else when you click the close button.
so the question is: How can I bind the visibility of contectpanes in MVVM ??
Actually whether a binding is TwoWay or not depends on how the DependencyProperty is defined - it defaults to OneWay unless the class defining the DP explicitly indicates that it should bind two way. Something like the Text property of a TextBox is defined as binding TwoWay but the Visibility property (which is defined by the WPF UIElement class) does not.
Hi Maria,
Thanks for your answer. Indeed the Mode=TwoWay did the job.
But it is a little bit strange because normally in WPF when nothing is specified, then the mode is twoway.
Once again Thanks
Hello Nawed,
I have put together a sample application where the Visibility property of a content pane is bound to a property in the viewmodel and it is being correctly updated when the pane is closed using the button. Please feel free to have a look at the sample application and let me know if the behavior is different on your side.
One thing that I have noticed in the code snippet is that the binding mode is not set to TwoWay which will prevent the data to be updated when the visibility is changed in the UI.
Feel free to let me know if you have any questions or concerns.