diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs index d7b3eaba..67030492 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs @@ -84,25 +84,31 @@ namespace Xceed.Wpf.AvalonDock.Layout #region ContentId - private string _contentId = null; + //Added to make ContentId bindable + public static DependencyProperty ContentIdProperty = + DependencyProperty.Register(nameof(ContentId), + typeof(string), typeof(LayoutContent), new FrameworkPropertyMetadata(null, (s, e) => + { + (s as LayoutContent)?.RaisePropertyChanged(nameof(ContentId)); + })); + public string ContentId { - get + get { - if (_contentId == null) - { + if (GetValue(ContentIdProperty) == null) + { var contentAsControl = _content as FrameworkElement; if (contentAsControl != null && !string.IsNullOrWhiteSpace(contentAsControl.Name)) return contentAsControl.Name; } - return _contentId; + return (string)GetValue(ContentIdProperty); } set { - if (_contentId != value) + if (!String.Equals(GetValue(ContentIdProperty) as string, value)) { - _contentId = value; - RaisePropertyChanged("ContentId"); + SetValue(ContentIdProperty, value); } } }