Fluent.Ribbon
Fluent.Ribbon copied to clipboard
ContextMenus don't automatically adapt according to input device
Long story short, Fluent.Ribbon ContextMenus don't do this:
Here's the current state of my efforts to create a solution to this: TouchableContextMenuBehavior attempt for Fluent Ribbon.zip Note that this stuff wasn't originally written for Fluent.Ribbon, and has not been adapted for use with it at all (other than removing a handful of attached properties related to other stuff)
Currently, only three real problems remain:
- The menu doesn't adapt its size as intended the first time it is opened
- This whole thing would probably fall apart if the menu is moved from one element to another, or if its
PlacementTarget
and the control whoseContextMenu
property it occupies become different - The menu seemingly occasionally opens in the wrong size (although this may just be my head messing with me, idk for sure) I've tried everything I can think of to resolve problem 1 to no avail, but as for problem 2...I don't even know where to start. Problem 3 may or may not actually exist. If these issues were resolved, I'm fairly certain we'd have a pretty robust implementation of this size-changing capability.
Additionally, the behaviour requires a small amount of restyling for both the ContextMenu
and MenuItem
s in order to behave as intended (the former to set IsContextMenuTouchable
to true
, thereby attaching the behaviour, and the latter to actually resize the MenuItem
s according to a binding to the ContextMenu
's OpenedWithTouch
property (I did this using a DataTrigger
and enlarged Padding
). No idea if either of these styling requirements can be eliminated, but if it is possible, I think that would be ideal.
Environment
- Fluent.Ribbon vN/A, I haven't actually tested these with Fluent.Ribbon
- Windows 8.1
- .NET Framework 4.7.2, but could probably be backported easily if needed, idk