0

I have a WPF Project using AvalonDock, the problem is I want to show the close panel when click the MenuItem, What I have now as follows:

<MenuItem Header="Views(_V)">
            <MenuItem Header="SolutionViews" IsCheckable="True" IsChecked="{Binding DocumentSolutionPanel.IsVisible, Mode=TwoWay}"/>
            <MenuItem Header="HardwareConfiguration" IsCheckable="True" IsChecked="{Binding DocumentHardwarePanel.IsVisible, Mode=TwoWay}"/>
            <MenuItem Header="HardwareInfo" IsCheckable="True" IsChecked="{Binding DocumentHWInfoPanel.IsVisible ,Mode=TwoWay}"/>
            <MenuItem Header="ConfigurationInfo" IsCheckable="True" IsChecked="{Binding DocumentConfigurationPanel.IsVisible, Mode=TwoWay}"/>
            <MenuItem Header="CommunicationParam" IsCheckable="True" IsChecked="{Binding DocumentCommunicationPanel.IsVisible, Mode=TwoWay}"/>
        </MenuItem>

Taking DocumentSolutionPanel for example:

public class DocumentSolutionPanelViewModel : AbstractPanelViewModel
{
    public DocumentSolutionPanelViewModel()
    {

    }
}

And:

public abstract class AbstractPanelViewModel : AbstractViewModel
{
    private bool isVisible = false;

    public bool IsVisible
    {
        get { return isVisible; }
        set
        {
            if (isVisible == value)
                return;

            isVisible = value;
            OnPropertyChanged("IsVisible");
        }
    }

}

And:

    private DocumentSolutionPanelViewModel _documentSolutionPanel = null;
    public DocumentSolutionPanelViewModel DocumentSolutionPanel
    {
        get
        {
            if (_documentSolutionPanel == null)
                _documentSolutionPanel = new DocumentSolutionPanelViewModel();

            return _documentSolutionPanel;
        }
    }

What's wrong with my code?Thanks!

Lee Barry
  • 37
  • 9
  • From the code you posted is not clear but of course you have added all the documents view models to the Docking Manger DocumentsSource collection right ? – Antonello G. Bianchi Jun 05 '17 at 06:48
  • It did call the _AbstractPaneViewModel_ when i click the button but for some reason i don't know the action didn't executed – Lee Barry Jun 06 '17 at 02:43

0 Answers0