Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1280
Visibility of ContentPanes MVVM
posted

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 ??

Parents
No Data
Reply
  • 17475
    Verified Answer
    Offline posted

    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.

    XamDockManagerContPaneVis.zip
Children