Skip to content

Commit

Permalink
Merge pull request #314 from siegfriedpammer/ilspy-issue-2577
Browse files Browse the repository at this point in the history
Fix NavigatorWindow not working if there is only one document
  • Loading branch information
Dirkster99 authored Dec 16, 2021
2 parents 9ffd291 + 2c66156 commit f58ae9a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions source/Components/AvalonDock/Controls/NavigatorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ internal NavigatorWindow(DockingManager manager)
SetAnchorables(_manager.Layout.Descendents().OfType<LayoutAnchorable>().Where(a => a.IsVisible).Select(d => (LayoutAnchorableItem)_manager.GetLayoutItemFromModel(d)).ToArray());
SetDocuments(_manager.Layout.Descendents().OfType<LayoutDocument>().OrderByDescending(d => d.LastActivationTimeStamp.GetValueOrDefault()).Select(d => (LayoutDocumentItem)_manager.GetLayoutItemFromModel(d)).ToArray());
_internalSetSelectedDocument = false;
if (Documents.Length > 1)
if (Documents.Length > 0)
{
InternalSetSelectedDocument(Documents[1]);
InternalSetSelectedDocument(Documents[0]);
_isSelectingDocument = true;
}
else if (Anchorables.Count() > 1)
else
{
InternalSetSelectedAnchorable(Anchorables.ToArray()[1]);
_isSelectingDocument = false;
var anchorable = Anchorables.FirstOrDefault();
if (anchorable != null)
{
InternalSetSelectedAnchorable(anchorable);
_isSelectingDocument = false;
}
}
DataContext = this;
Loaded += OnLoaded;
Expand Down

0 comments on commit f58ae9a

Please sign in to comment.