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!