Skip to content

Commit

Permalink
Remove ActiveContent if SelectedContentIndex == -1 and ChildrenCount …
Browse files Browse the repository at this point in the history
…<= 0
  • Loading branch information
Dirkster99 committed Oct 7, 2019
1 parent f0afbfe commit 37109e1
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,27 @@ protected override void OnChildrenCollectionChanged()
{
if( this.SelectedContentIndex >= this.ChildrenCount )
this.SelectedContentIndex = this.Children.Count - 1;
if( this.SelectedContentIndex == -1 && this.ChildrenCount > 0 )
if( this.SelectedContentIndex == -1 )
{
if( this.Root == null )
if( this.ChildrenCount > 0 )
{
this.SetNextSelectedIndex();
if( this.Root == null )
{
this.SetNextSelectedIndex();
}
else
{
var childrenToSelect = this.Children.OrderByDescending( c => c.LastActivationTimeStamp.GetValueOrDefault() ).First();
this.SelectedContentIndex = this.Children.IndexOf( childrenToSelect );
childrenToSelect.IsActive = true;
}
}
else
{
var childrenToSelect = this.Children.OrderByDescending( c => c.LastActivationTimeStamp.GetValueOrDefault() ).First();
this.SelectedContentIndex = this.Children.IndexOf( childrenToSelect );
childrenToSelect.IsActive = true;
if( this.Root != null )
{
this.Root.ActiveContent = null;
}
}
}

Expand Down

0 comments on commit 37109e1

Please sign in to comment.