Skip to content

Commit

Permalink
AvalonDock Fixed some null reference exceptions #1170
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirkster99 committed Nov 14, 2018
1 parent ce27dd0 commit d6e8ef9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal static class _XceedVersionInfo
public const string BaseVersion = "3.4";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.7";
".0.8";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string PublicKeyToken = "ba83ff368b7563c6";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public ILayoutElement Model

protected override void OnGotKeyboardFocus( System.Windows.Input.KeyboardFocusChangedEventArgs e )
{
if( ( _model != null ) && ( _model.SelectedContent != null ) )
if (_model?.SelectedContent != null)
{
_model.SelectedContent.IsActive = true;
_model.SelectedContent.IsActive = true;
}

base.OnGotKeyboardFocus( e );
}

Expand Down
20 changes: 7 additions & 13 deletions source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,14 @@ public ContentPresenter View
{
get
{
if( _view == null )
if (_view == null)
{
_view = new ContentPresenter();

_view.SetBinding( ContentPresenter.ContentProperty, new Binding( "Content" ) { Source = LayoutElement } );
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 );
}
}
_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);
}

return _view;
Expand Down

0 comments on commit d6e8ef9

Please sign in to comment.