Reputation: 175
I am trying to embed a slider control as a menu item in UWP:
This can be done with Windows Forms' ToolStripControlHost
class and, on WPF, by just adding a Slider
directly inside a MenuItem
in the XAML.
In UWP, adding a Slider
inside a MenuFlyoutSubItem
does not work as the MenuFlyoutSubItem
expects a MenuFlyoutItemBase
.
Writting a SliderMenuFlyoutItem
that extends MenuFlyoutSubItem
seems like the logical approach, however I am not sure how to draw the Slider
and handle the mouse events in this case.
Any pointers on how this can be achieved?
Thanks
Upvotes: 1
Views: 471
Reputation: 1450
You can try to use a Flyout instead of a MenuFlyout
<Flyout>
<StackPanel>
<MenuFlyoutItem Text="Item1"/>
<MenuFlyoutItem Text="Item2"/>
<Slider Width="100" Maximum="100" Minimum="0"/>
<MenuFlyoutSeparator />
<MenuFlyoutItem Text="Item3"/>
</StackPanel>
</Flyout>
Upvotes: 1