diff --git a/src/CommunityToolkit.Maui.MediaElement/Primitives/CustomTransportControls.windows.cs b/src/CommunityToolkit.Maui.MediaElement/Primitives/CustomTransportControls.windows.cs index 9df28c6d04..ef64d5d01b 100644 --- a/src/CommunityToolkit.Maui.MediaElement/Primitives/CustomTransportControls.windows.cs +++ b/src/CommunityToolkit.Maui.MediaElement/Primitives/CustomTransportControls.windows.cs @@ -6,7 +6,6 @@ sealed partial class CustomTransportControls : MediaTransportControls { public event EventHandler? OnTemplateLoaded; public AppBarButton FullScreenButton = new(); - bool isFullScreen = false; public CustomTransportControls() { @@ -22,21 +21,6 @@ protected override void OnApplyTemplate() FullScreenButton = appBarButton; FullScreenButton.Visibility = Microsoft.UI.Xaml.Visibility.Visible; OnTemplateLoaded?.Invoke(this, EventArgs.Empty); - FullScreenButton.Click += FullScreenButton_Click; - } - } - - void FullScreenButton_Click(object sender, RoutedEventArgs e) - { - if (isFullScreen) - { - FullScreenButton.Icon = new FontIcon { Glyph = "\uE740" }; - isFullScreen = false; - } - else - { - FullScreenButton.Icon = new SymbolIcon(Symbol.BackToWindow); - isFullScreen = true; } } } \ No newline at end of file diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs index 3ca4b23d6b..497835e4d0 100644 --- a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs +++ b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs @@ -195,6 +195,7 @@ void OnFullScreenButtonClick(object sender, RoutedEventArgs e) var parent = mediaPlayerElement.Parent as FrameworkElement; mediaPlayerElement.Width = parent?.Width ?? mediaPlayerElement.Width; mediaPlayerElement.Height = parent?.Height ?? mediaPlayerElement.Height; + customTransportControls?.FullScreenButton.Icon = new FontIcon { Glyph = "\uE740" }; } else { @@ -221,6 +222,7 @@ void OnFullScreenButtonClick(object sender, RoutedEventArgs e) { popup.IsOpen = true; } + customTransportControls?.FullScreenButton.Icon = new SymbolIcon(Symbol.BackToWindow); } } } \ No newline at end of file