Closed zeyus closed 3 months ago
Hi @zeyus, thanks a lot for your contribution. I remember trying this briefly and running into similar problems. The solution feels a little hacky, but then again I also don't know a better solution. One thing that comes to mind: With the focus checks on the ComboBox
and TabControl
, is it still possible to select filters using the keyboard shortcuts Tab/Shift+Tab?
Hi @zeyus, thanks a lot for your contribution. I remember trying this briefly and running into similar problems. The solution feels a little hacky, but then again I also don't know a better solution. One thing that comes to mind: With the focus checks on the
ComboBox
andTabControl
, is it still possible to select filters using the keyboard shortcuts Tab/Shift+Tab?
No probs @srwi, least I can do seeing as I'm enjoying using EverythingToolbar :)
I agree it feels a little hacky, although this does specifically check that the selected item change is due to a user interaction rather than the initial population / sync with binding, so conceptually it makes sense.
What I don't understand is that there isn't an obvious way to prevent population/syncing from firing the events (or to bind the handlers after all items are loaded). Maybe it requires way more C#
foo than I have haha.
Just confirmed keyboard shortcuts are working as expected (because the tab/combo elements have isFocused == True
when tabbing to them).
I agree it feels a little hacky, although this does specifically check that the selected item change is due to a user interaction rather than the initial population / sync with binding, so conceptually it makes sense.
You're right. I think it is fine. Especially since it's well contained within the FilterSelector control.
What I don't understand is that there isn't an obvious way to prevent population/syncing from firing the events (or to bind the handlers after all items are loaded). Maybe it requires way more
C#
foo than I have haha.
Probably the correct way would be to bind the currently selected filter to both SelectedIndex
s with a value converter rather than listening to the property changing, but then I don't really know whether it would help at all with the problem you're describing.
In any case, I really like your solution and it works quite well for me, so I'll merge the PR. Thanks again for your contribution!
This PR fixes https://github.com/srwi/EverythingToolbar/issues/481 so the selected filter is saved on selection change, and updates the tab and combo to only update if the element is under the mouse cursor or focused.
I implemented it this way because I'm not familiar with
C#
and couldn't figure out why onShow()
it would fire the SelectionChanged event...In the code there should be nothing triggering it (it kept defaulting back toAll
even though when I was debugging, theSettings.Default.lastFilter
showed the correctly selected filter.Anyway, if you have a suggestion on how to avoid that issue and maybe bind the
SelectedIndex
directly (I tried that and it still fired onShow()
) let me know, and I will update the PR, otherwise, this works. :)