Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveContent not switching correctly for floating window #135

Closed
Muhahe opened this issue Mar 11, 2020 · 5 comments
Closed

ActiveContent not switching correctly for floating window #135

Muhahe opened this issue Mar 11, 2020 · 5 comments
Labels

Comments

@Muhahe
Copy link
Contributor

Muhahe commented Mar 11, 2020

Hi,

i noticed another strange behavior, which can be easily reproduced in your MVVMTestApp.

In case you have atleast two documents (doc1, doc2) and some panel that displays content based on ActiveContent property of avalondock (FileStatsPanel).

Place doc1 as normal document
Place FileStatsPanel as side panel
Place doc2 as floating window

image

Then when you select doc1, FileStatsPanel displays data based on doc1 - ok
When you select doc2, FileStatsPanel displays data based on doc2 - ok

Steps

  1. select doc1
  2. select doc2
  3. select File Stats panel

If you make steps 1,2,3 then fileStatsPanel will display content based on doc1 instead of doc2. So editing FileStats data for doc2 isnt possible in this case

if ou make steps 1,2,3,2,3 then fileStatsPanel will display content correctly.

When FileStatsPanel is as floating panel, everything works fine.

In my opinion, issue is based on changing ActiveContent to document when clicking from floating window into non-floating panel, then ActiveContent is changed to document that is in same window as non-floating panel. (can be observed by breakpoint in workspace.cs -> ActiveDocument setter (line 109?)

MVVMTestApp.dll!AvalonDock.MVVMTestApp.Workspace.ActiveDocument.set(AvalonDock.MVVMTestApp.FileViewModel value) Line 109 C#
[External Code]
AvalonDock.dll!AvalonDock.DockingManager.ActiveContent.set(object value) Line 1027 C#
AvalonDock.dll!AvalonDock.DockingManager.OnLayoutRootPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) Line 1794 C#
AvalonDock.dll!AvalonDock.Layout.LayoutElement.RaisePropertyChanged(string propertyName) Line 128 C#
AvalonDock.dll!AvalonDock.Layout.LayoutRoot.InternalSetActiveContent(AvalonDock.Layout.LayoutContent currentValue, AvalonDock.Layout.LayoutContent newActiveContent) Line 750 C#
AvalonDock.dll!AvalonDock.Layout.LayoutRoot.ActiveContent.set(AvalonDock.Layout.LayoutContent value) Line 235 C#
AvalonDock.dll!AvalonDock.Layout.LayoutContent.IsActive.set(bool value) Line 183 C#
AvalonDock.dll!AvalonDock.Controls.LayoutDocumentControl.SetIsActive() Line 135 C#
AvalonDock.dll!AvalonDock.Controls.LayoutDocumentControl.OnPreviewGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e) Line 111 C#

@Dirkster99
Copy link
Owner

Dirkster99 commented Mar 13, 2020

I can verify the issue and extended the MVVMTestApp sample to make the issue more obvious.

I can place a line like:
Debug.WriteLine("OnPreviewGotKeyboardFocus: " + LayoutItem.ContentId);

into LayoutDocumentControl.OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
at line 110 to see that the document in the MainWindow receives the focus preview event.

I am not sure this is bug. To me this looks more like a WPF limitation because I don't know how to distinguish this event from the real event when the user clicks inside the document(?). Do you have an idea how to handle this differently?

@Dirkster99 Dirkster99 added the bug label Mar 13, 2020
@Muhahe
Copy link
Contributor Author

Muhahe commented Apr 8, 2020

I just cant figgure out why document is receiving focus when is not clicked. I expected, that properties panel should got focus not document

@Dirkster99
Copy link
Owner

Yes I do not have more information ever - the event is being raised by WPF and I do not know exactly why in this manner...

@LyonJack
Copy link
Contributor

LyonJack commented Jul 2, 2020

Fixed in my pull request @Dirkster99

@Dirkster99
Copy link
Owner

Looks good to me too :-)
@Muhahe Please let us know if you see anything we are missing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants