Browse Source

AvalonDock Made ContentID Bindable in LayoutContent.cs

pull/1172/head
John Stewien 9 years ago
parent
commit
23a6e2f5db
  1. 22
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs

22
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);
}
}
}

Loading…
Cancel
Save