I'm using MVVM to add documents and tool windows to the docking & mdi framework and have all the properties I need working except the DockingWindow.IsOpen property binding. Is there a bug with binding to this property or maybe my code is incorrect?
View Bindings
<!-- docking:DockingWindow -->
<Style x:Key="DockingItemStyle" TargetType="docking:DockingWindow">
<Setter Property="CanClose" Value="{Binding CanClose}"/>
<Setter Property="CanMaximize" Value="{Binding CanMaximize}"/>
<Setter Property="CanRaft" Value="{Binding CanRaft}"/>
<Setter Property="Description" Value="{Binding Description}" />
<Setter Property="HasTitleBar" Value="{Binding HasTitleBar}"/>
<Setter Property="ImageSource" Value="{Binding ImageSource}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}"/>
<Setter Property="IsSelected" Value="{Binding IsSelected}"/>
<Setter Property="Title" Value="{Binding Title}"/>
<Setter Property="CanDrag" Value="{Binding CanDrag}"/>
</Style>
View Model
public abstract class DockingBase : INotifyPropertyChanged
{
private Boolean _CanClose = true;
private Boolean _CanMaximize = true;
private Boolean _CanRaft = true;
private String _Description = String.Empty;
private Boolean _HasTitleBar = true;
private ImageSource _ImageSource;
private Boolean _IsOpen = false;
private Boolean _IsSelected = false;
private String _Title = String.Empty;
private Boolean _CanDrag = true;
public DockingBase()
{
Id = Guid.NewGuid();
}
public Guid Id { get; protected set; }
public Boolean CanDrag
{
get { return _CanDrag; }
set
{
_CanDrag = value;
NotifyPropertyChanged("CanDrag");
}
}
public Boolean CanClose
{
get { return _CanClose; }
set
{
_CanClose = value;
NotifyPropertyChanged("CanClose");
}
}
public Boolean CanMaximize
{
get { return _CanMaximize; }
set
{
_CanMaximize = value;
NotifyPropertyChanged("CanMaximize");
}
}
public Boolean CanRaft
{
get { return _CanRaft; }
set
{
_CanRaft = value;
NotifyPropertyChanged("CanRaft");
}
}
public String Description
{
get { return _Description; }
set
{
_Description = value;
NotifyPropertyChanged("Description");
}
}
public Boolean HasTitleBar
{
get { return _HasTitleBar; }
set
{
_HasTitleBar = value;
NotifyPropertyChanged("HasTitleBar");
}
}
public ImageSource ImageSource
{
get { return _ImageSource; }
set
{
_ImageSource = value;
NotifyPropertyChanged("ImageSource");
}
}
public Boolean IsOpen
{
get { return _IsOpen; }
set
{
_IsOpen = value;
NotifyPropertyChanged("IsOpen");
}
}
public Boolean IsSelected
{
get { return _IsSelected; }
set
{
_IsSelected = value;
NotifyPropertyChanged("IsSelected");
}
}
public String Title
{
get { return _Title; }
set
{
_Title = value;
NotifyPropertyChanged("Title");
}
}
protected void NotifyPropertyChanged(String property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}