Browse Source

Navigator window changes merge to apd-master.

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

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

@ -244,85 +244,92 @@ 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;
} }
} }
} }
// 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(); {
shouldHandle = true; this.SelectNextAnchorable();
} shouldHandle = true;
// Jump to first LayoutDocument }
else if( this.Documents.Length > 0 ) // Jump to first LayoutDocument
{ else if (this.Documents.Length > 0)
_isSelectingDocument = true; {
this.InternalSetSelectedAnchorable( null ); _isSelectingDocument = true;
this.InternalSetSelectedDocument( this.Documents[ 0 ] ); this.InternalSetSelectedAnchorable(null);
shouldHandle = true; this.InternalSetSelectedDocument(this.Documents[0]);
} shouldHandle = true;
} }
// There is no SelectedAnchorable, select the first one. else if (!this.Documents.Any() && this.Anchorables.Any())
else {
{ this.InternalSetSelectedAnchorable(this.Anchorables.ToArray()[0]);
if( this.Anchorables.Count() > 0 ) shouldHandle = true;
{ }
this.InternalSetSelectedAnchorable( this.Anchorables.ToArray()[ 0 ] ); }
shouldHandle = true; // There is no SelectedAnchorable, select the first one.
} else
} {
} if (this.Anchorables.Count() > 0)
} {
this.InternalSetSelectedAnchorable(this.Anchorables.ToArray()[0]);
if( shouldHandle ) shouldHandle = true;
{ }
e.Handled = true; }
} }
base.OnPreviewKeyDown( e ); }
}
if (shouldHandle)
protected override void OnPreviewKeyUp( System.Windows.Input.KeyEventArgs e ) {
e.Handled = true;
}
base.OnPreviewKeyDown(e);
}
protected override void OnPreviewKeyUp( System.Windows.Input.KeyEventArgs e )
{ {
if( e.Key != System.Windows.Input.Key.Tab ) if( e.Key != System.Windows.Input.Key.Tab )
{ {

Loading…
Cancel
Save