Skip to content

Commit

Permalink
Fixing NullReferenceException on LayoutElement in LayoutItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirkster99 committed Oct 6, 2019
1 parent fdc7f6a commit c06efac
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,15 @@ public ContentPresenter View
_view = new ContentPresenter();

_view.SetBinding( ContentPresenter.ContentProperty, new Binding( "Content" ) { Source = LayoutElement } );
_view.SetBinding( ContentPresenter.ContentTemplateProperty, new Binding( "LayoutItemTemplate" ) { Source = LayoutElement.Root.Manager } );
_view.SetBinding( ContentPresenter.ContentTemplateSelectorProperty, new Binding( "LayoutItemTemplateSelector" ) { Source = LayoutElement.Root.Manager } );
LayoutElement.Root.Manager.InternalAddLogicalChild( _view );
if( ( LayoutElement != null ) && ( LayoutElement.Root != null ) )
{
_view.SetBinding( ContentPresenter.ContentTemplateProperty, new Binding( "LayoutItemTemplate" ) { Source = LayoutElement.Root.Manager } );
_view.SetBinding( ContentPresenter.ContentTemplateSelectorProperty, new Binding( "LayoutItemTemplateSelector" ) { Source = LayoutElement.Root.Manager } );
if( LayoutElement.Root.Manager != null )
{
LayoutElement.Root.Manager.InternalAddLogicalChild( _view );
}
}
}

return _view;
Expand Down

0 comments on commit c06efac

Please sign in to comment.