这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions source/Components/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ public object Content

if( this.ContentId == null )
{
var contentAsControl = _content as FrameworkElement;
if( contentAsControl != null && !string.IsNullOrWhiteSpace( contentAsControl.Name ) )
{
this.SetCurrentValue( LayoutContent.ContentIdProperty, contentAsControl.Name );
}
SetContentIdFromContent();
}
}
}
Expand All @@ -112,7 +108,13 @@ public string ContentId
{
get
{
return (string)GetValue( ContentIdProperty );
string value = (string)GetValue(ContentIdProperty);
if (!string.IsNullOrWhiteSpace(value)) return value;

// #83 - if Content.Name is empty at setting content and will be set later, ContentId will stay null.
SetContentIdFromContent();

return (string)GetValue(ContentIdProperty);
}
set
{
Expand All @@ -136,6 +138,16 @@ private void OnContentIdPropertyChanged( string oldValue, string newValue )
this.RaisePropertyChanged( "ContentId" );
}
}

private void SetContentIdFromContent()
{
var contentAsControl = _content as FrameworkElement;
if (!string.IsNullOrWhiteSpace(contentAsControl?.Name))
{
this.SetCurrentValue(LayoutContent.ContentIdProperty, contentAsControl.Name);
}
}

#endregion ContentId

#region IsSelected
Expand Down