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

AutoHide does not work with ScrollViewer #62

Closed
Martin5630 opened this issue Aug 13, 2019 · 6 comments
Closed

AutoHide does not work with ScrollViewer #62

Martin5630 opened this issue Aug 13, 2019 · 6 comments

Comments

@Martin5630
Copy link

Martin5630 commented Aug 13, 2019

The AutoHide function does not work with controls that have a scrollviwer inside the controltemplate.

I have tested with MLibTest.

Step to reproduce:

  1. Start MLibTest
  2. Open New File
  3. Dock the Tool 3-Window to the right side and select Autohide.
  4. Open Tool3 Window
  5. Click inside New File
  6. The Tool3 Window does not disappear..

image

@Martin5630 Martin5630 changed the title AutoHide dont work anymore AutoHide dont work with ScrollViewer Aug 13, 2019
@Martin5630
Copy link
Author

@Dirkster99 currently I dont why but if you have a control with a scrollviewer inside the controltemplate the autohide function no longer works. AvalonDock set the ActiveContent to the ToolWindow and then back to the DocumentPane if the Pane as a Scrollviewer as Content.

you can see the problem if you change the FileViewTemplate.

Set the Template to this:

<bindLocal:PanesTemplateSelector.FileViewTemplate>
  <DataTemplate>
    <Grid>
      <ListBox />
    </Grid>
  </DataTemplate>
</bindLocal:PanesTemplateSelector.FileViewTemplate>

the autohide function no longer works

if you Change the template to this

<bindLocal:PanesTemplateSelector.FileViewTemplate>
  <DataTemplate>
    <Grid>
      <TextBlock></TextBlock>
    </Grid>
  </DataTemplate>
</bindLocal:PanesTemplateSelector.FileViewTemplate>

the Auto hide functions works as expected.

an now add a scrollviewer

<bindLocal:PanesTemplateSelector.FileViewTemplate>
  <DataTemplate>
    <Grid>
      <ScrollViewer >
        <TextBlock />
      </ScrollViewer>
    </Grid>
  </DataTemplate>
</bindLocal:PanesTemplateSelector.FileViewTemplate>

the function don't work anymore.

@Dirkster99
Copy link
Owner

Interesting... I will investigate this and get back to you when I have more ideas about this problem. Thanks for the analysis and useful description to verify the problem 👍

@Dirkster99 Dirkster99 changed the title AutoHide dont work with ScrollViewer AutoHide does not work with ScrollViewer Aug 19, 2019
@Dirkster99
Copy link
Owner

Hi,

I've tried to verify your problem but I cannot find any special problem connected to a ScrollViewer. There is aleady a Color Picker tool window in MLibTest that comes (by random chance) with a ScrollViewer:

<demos:PanesTemplateSelector.ColorPickerViewTemplate>
    <DataTemplate>
        <Border Padding="6">
            <ScrollViewer>
                <demoviews:ColorSelectionView />
            </ScrollViewer>
        </Border>
    </DataTemplate>
</demos:PanesTemplateSelector.ColorPickerViewTemplate>

But I cannot see any special Auto Hide problem there. I always have to select the document or another tool window, move the mouse and the Auto Hide tool window dissappears. This is the behavior that I can see whether I use a ScrollViewer in the DataTemplate or not.

I think it is acceptable to have tool window dissappear after clicking inside the documnt and moving the mouse. I know this not what VS does but I am not sure whether fixing this issue is worth the effort - we could try to look further into it, but your expectation is that the tool window dissappears after clicking inside the new document without having to move the mouse, right?

@Martin5630
Copy link
Author

Hi,

I have made a recheck with my second reference project for AlavonDock Gemini. There it works like Visual Studio. One mouse click and the tool window disappears. I tried the same again as with your test project. With and without ScrollViewer and I came to the same result. Without it works, with ScrollViewer not. Since the demo program MonoGame also uses a ScrollViewer I thought the problem must be somewhere else. I commented out everything in the methods for Mouse-Down and Mouse-Up. Finally the line where the focus is set on the GraphicsControl remained. With this line it works without problems. So I think AvalonDock has a problem with the management of the Focus.

image

image

Kind regards Martin

@Dirkster99
Copy link
Owner

Dirkster99 commented Aug 22, 2019

Yes it looks like there is a focus problem but its not necessarily in AvalonDock alone - remember AvalonDock needs to set and steel focus from/to documents and tool window to activate things when user do Control+Tab - worse still, controls (views) are unloaded when they become invisible...

My problem is that I cannot verify your problem since Gemini appears to be broken and your version is not public, is it? I even tried to update it myself but there was no response in ages... ...

Maybe you can have a look at my reference App Edi where I use the:

events to capture and restore the status of the document whenever the view is unloaded or (re-)loaded. I am not quit sure but your description sounds like this could be something useful to add to your control (?).

You could also try adding something like

Focusable="False"

to your scrollviewer to see if that makes a difference. If it does, I am not sure what it means as I don't know your app but I know focus issues with AvalonDock from the past but I got these to work in Edi and I hope it helps you getting your app to work as well. Please let me know if you make any progress (even if trying things and failing) as I am wondering what the issue is and other might face similar problem when converting from AD 2.x to 3.x ...

@Dirkster99
Copy link
Owner

Closing this now since it seems to get stalled - feel free to re-open if you have any news that shed a light on this one...

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

No branches or pull requests

2 participants