Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ sealed partial class CustomTransportControls : MediaTransportControls
{
public event EventHandler<EventArgs>? OnTemplateLoaded;
public AppBarButton FullScreenButton = new();
bool isFullScreen = false;

public CustomTransportControls()
{
Expand All @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -221,6 +222,7 @@ void OnFullScreenButtonClick(object sender, RoutedEventArgs e)
{
popup.IsOpen = true;
}
customTransportControls?.FullScreenButton.Icon = new SymbolIcon(Symbol.BackToWindow);
}
}
}
Loading