如何使用 MediaPlayerElement 将 ui 同步到全屏或紧凑模式 [英] How to sync ui to full screen or compact mode using MediaPlayerElement
问题描述
我正在使用 MediaPlayerElement
,当我的应用程序窗口处于正常大小时,我在 MediaPlayerElement
上有一个 Button 和一个 TextBox.但是当我点击全屏或紧凑按钮进入全屏或紧凑模式时,它们消失了.
如何以全屏或紧凑模式显示它们?
一个有用的存储库是
根据您的要求,您可以自定义您的 MediaTransportControls
并在样式中找到 ControlPanel_ControlPanelVisibilityStates_Border
.然后在该边框下添加您的元素.
例如
<网格><文本块水平对齐=中心"垂直对齐=顶部"字体大小=25"前景=红色"文字="这是标题"/><网格x:Name="ControlPanelGrid"垂直对齐=底部"背景="{ThemeResource SystemControlPageBackgroundAltMediumBrush}"RenderTransformOrigin="0.5,0.5"......
我将标题 TextBlock 添加到样式中.
I'm using MediaPlayerElement
, when my app window in normal size, I have a Button and a TextBox on the MediaPlayerElement
. But when I click fullscreen or compact button to enter fullscreen or compact mode, they disappeared.
How to show them in full screen or compact mode?
A helpfull repo is here, sync the TextBox to fullscreen.
For your requirement, you could custom your MediaTransportControls
and found ControlPanel_ControlPanelVisibilityStates_Border
in the style. Then add your element under the that border.
For example
<Border x:Name="ControlPanel_ControlPanelVisibilityStates_Border">
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="25"
Foreground="Red"
Text="This is title"
/>
<Grid
x:Name="ControlPanelGrid"
VerticalAlignment="Bottom"
Background="{ThemeResource SystemControlPageBackgroundAltMediumBrush}"
RenderTransformOrigin="0.5,0.5"
......
I add the title TextBlock into the style.
这篇关于如何使用 MediaPlayerElement 将 ui 同步到全屏或紧凑模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!