Browse Source

Navigator window changes merge to apd-master.

pull/1645/head
Christopher Brown 8 years ago
parent
commit
9da9358f2b
  1. 49
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/NavigatorWindow.cs

49
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/NavigatorWindow.cs

@ -244,40 +244,40 @@ namespace Xceed.Wpf.AvalonDock.Controls
_documentListBox = this.GetTemplateChild( PART_DocumentListBox ) as ListBox; _documentListBox = this.GetTemplateChild( PART_DocumentListBox ) as ListBox;
} }
protected override void OnPreviewKeyDown( System.Windows.Input.KeyEventArgs e ) protected override void OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e)
{ {
bool shouldHandle = false; bool shouldHandle = false;
// Press Tab to switch Selected LayoutContent. // Press Tab to switch Selected LayoutContent.
if( e.Key == System.Windows.Input.Key.Tab ) if (e.Key == System.Windows.Input.Key.Tab)
{ {
// Selecting LayoutDocuments // Selecting LayoutDocuments
if( _isSelectingDocument ) if (_isSelectingDocument)
{ {
if( this.SelectedDocument != null ) if (this.SelectedDocument != null)
{ {
// Jump to next LayoutDocument // Jump to next LayoutDocument
var docIndex = this.Documents.IndexOf<LayoutDocumentItem>( this.SelectedDocument ); var docIndex = this.Documents.IndexOf<LayoutDocumentItem>(this.SelectedDocument);
if( docIndex < ( this.Documents.Length - 1 ) ) if (docIndex < (this.Documents.Length - 1))
{ {
this.SelectNextDocument(); this.SelectNextDocument();
shouldHandle = true; shouldHandle = true;
} }
// Jump to first LayoutAnchorable // Jump to first LayoutAnchorable
else if( this.Anchorables.Count() > 0 ) else if (this.Anchorables.Count() > 0)
{ {
_isSelectingDocument = false; _isSelectingDocument = false;
this.InternalSetSelectedDocument( null ); this.InternalSetSelectedDocument(null);
this.InternalSetSelectedAnchorable( this.Anchorables.First() ); this.InternalSetSelectedAnchorable(this.Anchorables.First());
shouldHandle = true; shouldHandle = true;
} }
} }
// There is no SelectedDocument, select the first one. // There is no SelectedDocument, select the first one.
else else
{ {
if( this.Documents.Length > 0 ) if (this.Documents.Length > 0)
{ {
this.InternalSetSelectedDocument( this.Documents[ 0 ] ); this.InternalSetSelectedDocument(this.Documents[0]);
shouldHandle = true; shouldHandle = true;
} }
} }
@ -285,41 +285,48 @@ namespace Xceed.Wpf.AvalonDock.Controls
// Selecting LayoutAnchorables // Selecting LayoutAnchorables
else else
{ {
if( this.SelectedAnchorable != null ) if (this.SelectedAnchorable != null)
{ {
// Jump to next LayoutAnchorable // Jump to next LayoutAnchorable
var anchorableIndex = this.Anchorables.ToArray().IndexOf<LayoutAnchorableItem>( this.SelectedAnchorable ); var anchorableIndex = this.Anchorables.ToArray()
if( anchorableIndex < ( this.Anchorables.Count() - 1 ) ) .IndexOf<LayoutAnchorableItem>(this.SelectedAnchorable);
if (anchorableIndex < (this.Anchorables.Count() - 1))
{ {
this.SelectNextAnchorable(); this.SelectNextAnchorable();
shouldHandle = true; shouldHandle = true;
} }
// Jump to first LayoutDocument // Jump to first LayoutDocument
else if( this.Documents.Length > 0 ) else if (this.Documents.Length > 0)
{ {
_isSelectingDocument = true; _isSelectingDocument = true;
this.InternalSetSelectedAnchorable( null ); this.InternalSetSelectedAnchorable(null);
this.InternalSetSelectedDocument( this.Documents[ 0 ] ); this.InternalSetSelectedDocument(this.Documents[0]);
shouldHandle = true;
}
else if (!this.Documents.Any() && this.Anchorables.Any())
{
this.InternalSetSelectedAnchorable(this.Anchorables.ToArray()[0]);
shouldHandle = true; shouldHandle = true;
} }
} }
// There is no SelectedAnchorable, select the first one. // There is no SelectedAnchorable, select the first one.
else else
{ {
if( this.Anchorables.Count() > 0 ) if (this.Anchorables.Count() > 0)
{ {
this.InternalSetSelectedAnchorable( this.Anchorables.ToArray()[ 0 ] ); this.InternalSetSelectedAnchorable(this.Anchorables.ToArray()[0]);
shouldHandle = true; shouldHandle = true;
} }
} }
} }
} }
if( shouldHandle ) if (shouldHandle)
{ {
e.Handled = true; e.Handled = true;
} }
base.OnPreviewKeyDown( e );
base.OnPreviewKeyDown(e);
} }
protected override void OnPreviewKeyUp( System.Windows.Input.KeyEventArgs e ) protected override void OnPreviewKeyUp( System.Windows.Input.KeyEventArgs e )

Loading…
Cancel
Save