Dirkster99 / AvalonDock

Our own development branch of the well known WPF document docking library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keyboard up/down in textbox in floating anchorable focusing DropDownControlArea

Muhahe opened this issue · comments

Hi there,

i noticed strange behavior in your avalondock version when i have textbox in floating LayoutAnchorable.
If textbox in floating layoutAnchorable has focus and you prey keyup/keydown this textbox loses focus (even if textbox has multiple rows and caret should move to next/previous line).

in this case, caret is in "second line" and key up/down will result into focus lost of textbox and dropDownAreaControl is focused instead (i checked that in Snoop).
image

If anchorable is docked or there are multiple anchorables joined together, up/down arrows works.
image

There you can find modified test app (but i only added textbox into properties window)

I noticed same behavior for combobox (also in example and richtextbox). And tried this in edi version 01_02 and didnt notice this behavior...

We also encounter that problem so I tracked it down to be introduced in 64b30e7 by @LyonJack and in particular by changing the base type of DropDownControlArea class from UserControl to ContentControl.
So before creating a pull request I would like to ask why was that done so and whether it was needed for the main change or @LyonJack had just decided that there is no additional functionality in UserControl and DropDownControlArea can inherit from ContentControl as simpler base class.
It is also quite interesting why the problem is gone using UserControl but I don't want to dig into M$ implementation to check that.

I have maket sure that bug,I set the title bar‘s 'Focusable' as false,that make it not get the focus

Hi @LyonJack, I can see that you have changed Focusable to false in generic.xaml of AvalonDock library and only inside the template of LayoutAnchorableFloatingWindowControl. That would probably mean that if a theme is applied the problem will reoccur and also it is not clear if in other usages of DropDownControlArea we won't see the same issue.
I would suggest to change the default value of Focusable to false in static constructor of DropDownControlArea like that:

  static DropDownControlArea()
  {
    FocusableProperty.OverrideMetadata(typeof(DropDownControlArea), new FrameworkPropertyMetadata(false));
  }

That way it will be 'automatically` changed to false in all XAMLs and places of usage and we avoid the need to do changes in many places.