I have integrated AvalonDock 2.0 into my application. I\'ve bound the document and anchor-able sources to my view-model which are rendered with the proper user controls via
I used this :
XAML:
Model :
public ObservableCollection _ListUserPanelAnchorable;
ReadOnlyObservableCollection _readonyFiles = null;
public ReadOnlyObservableCollection ListUserPanelAnchorable
{
get
{
if (_readonyFiles == null)
_readonyFiles = new ReadOnlyObservableCollection(_ListUserPanelAnchorable);
return _readonyFiles;
}
}
xaml.cs:
private void loadLayout()
{
//dockPanelModel.ListUserPanel.Clear();
//dockPanelModel.ListUserPanelAnchorable.Clear();
var serializer = new XmlLayoutSerializer(dockManager);
serializer = new XmlLayoutSerializer(dockManager);
serializer.LayoutSerializationCallback += (s, args) =>
{
args.Content = userPanel;
dockPanelModel._ListUserPanelAnchorable.Add(userPanel);
}
}
public AvaladonDockPanel()
{
InitializeComponent();
this.Loaded += AvaladonDockPanel_Loaded;
}
void AvaladonDockPanel_Loaded(object sender, RoutedEventArgs e)
{
loadLayout();
}
userpanel:
public class UserPanel
{
public string Title { get; set; }
public string ToolTip { get; set; }
public string IconSource { get; set; }
private Guid _contentGuid = Guid.NewGuid();
public Guid ContentId
{
get { return _contentGuid; }
set { _contentGuid = value; }
}
private UserControl _UserInterface;
public UserControl UserInterface { get { return _UserInterface; } set { _UserInterface = value; NotifyPropertyChanged("UserInterface"); } }
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
Debug.WriteLine(string.Format("PropertyChanged-> {0}", propertyName));
}
}
}
binding avalon to userpanel: