Commit 37c43bac authored by Stéphane Mitermite's avatar Stéphane Mitermite Committed by Martin Finkel

Prevent AspectRatio menu item from being unchecked

parent c36a2e15
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using FontAwesome;
......@@ -696,18 +696,29 @@ namespace LibVLCSharp.Uno
private void AspectRatioMenuItemClick(AspectRatio aspectRatio)
{
Manager.Get<AspectRatioManager>().AspectRatio = aspectRatio;
var aspectRatioManager = Manager.Get<AspectRatioManager>();
var currentAspectRatio = aspectRatioManager.AspectRatio;
aspectRatioManager.AspectRatio = aspectRatio;
if (currentAspectRatio == aspectRatio)
{
// To prevent the menu item from being unchecked
UpdateZoomMenu(aspectRatio);
}
}
private void AspectRatioChanged(object sender, EventArgs e)
private void UpdateZoomMenu(AspectRatio aspectRatio)
{
if (ZoomMenu != null)
{
var aspectRatio = ((AspectRatioManager)sender).AspectRatio;
CheckMenuItem(ZoomMenu, ZoomMenu.Items.OfType<ToggleMenuFlyoutItem>().First(i => (AspectRatio)i.CommandParameter == aspectRatio));
}
}
private void AspectRatioChanged(object sender, EventArgs e)
{
UpdateZoomMenu(((AspectRatioManager)sender).AspectRatio);
}
private void Flyout_Opened(object sender, object e)
{
Manager.Get<AutoHideNotifier>().Enabled = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment