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

Drop down list with scroll bar doesn't select correct item #402

Closed
GeertvanHorrik opened this issue Mar 8, 2017 · 8 comments
Closed

Drop down list with scroll bar doesn't select correct item #402

GeertvanHorrik opened this issue Mar 8, 2017 · 8 comments

Comments

@GeertvanHorrik
Copy link
Contributor

I thought it was fixed in v5, but installing the prerelease still gives the same behavior:

fluent_ribbon

.NET fx 4.0
Fluent.Ribbon 5.0.0 (stable, from AppVeyor)

Will try to find the cause and update this ticket.

@GeertvanHorrik
Copy link
Contributor Author

GeertvanHorrik commented Mar 8, 2017

Even with ClosePopupOnMouseDown set to false it picks the wrong item.

@GeertvanHorrik
Copy link
Contributor Author

Basically the scrolling gets reset as soon as you focus the drop down content.

@GeertvanHorrik
Copy link
Contributor Author

This seems to work in the demo app. Investigating why this isn't working in our component.

@GeertvanHorrik
Copy link
Contributor Author

GeertvanHorrik commented Mar 8, 2017

I can also reproduce strange scrolling behavior in the demo app. Note that I don't even click items here, just using the scroll buttons (hover only).

fluent_ribbon_01

@GeertvanHorrik
Copy link
Contributor Author

Found the cause. Whenever I use a StackPanel as ItemsPanelTemplate, this issue occurs. So this is reproducable in the app like this:

                    <Fluent:DropDownButton Header="Dropdown (auto close on click) g"
                                           ResizeMode="Both"
                                           Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Icons/App.ico"
                                           LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Icons/App.ico"
                                           ClosePopupOnMouseDown="True"
                                           ClosePopupOnMouseDownDelay="250">
                        <Grid>
                            <ListBox ItemsSource="{Binding StringItems}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>

                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <MenuItem Header="{Binding}" Click="OnAutoCloseDropDownButtonMenuItemClick"/>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ListBox>
                        </Grid>
                    </Fluent:DropDownButton>

When I remove the custom ItemsPanelTemplate, it doesn't show this strange behavior.

@GeertvanHorrik
Copy link
Contributor Author

For now I will close this issue since I can live without a custom ItemsPanelTemplate. Hopefully this ticket can be used as a reference for others bumping into this issue.

@batzen
Copy link
Member

batzen commented Mar 11, 2017

@GeertvanHorrik
The scrolling is intentional because of ClickMode="Hover".

The jumping selection is just the regular ScrollViewer in ScrollViewer problem.
Just set ScrollViewer.CanContentScroll="False" on your ListBox and everything is fine.
Scrolling by mouse still won't work that way.

I wonder why you even use a ListBox and don't rely on the DropDownButton already inheriting from MenuBase.

@GeertvanHorrik
Copy link
Contributor Author

It's a control from an external lib which I am embedding into the ribbon. So in regular situations it would be perfect to have a ListBox inside the control.

I still find it strange that whenever I don't use an ItemsPanel, it works fine. Anyway, it's solved for now :)

And great work on v5, much appreciated!

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