gpt4 book ai didi

c# - 如何启动全屏应用程序?

转载 作者:太空宇宙 更新时间:2023-11-03 11:10:08 25 4
gpt4 key购买 nike

我找到了一些代码,我想知道是否有人可以解释它是如何工作的。

<Window x:Class="FullScreenDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:Einstein="clr-namespace:FullScreenDemo"
Title="FullScreenBehavior Demo" Width="640" Height="480"
Einstein:FullScreenBehavior.IsFullScreen="{Binding Path=IsChecked, ElementName=FullScreenButton, Mode=TwoWay}">

<i:Interaction.Behaviors>
<Einstein:FullScreenBehavior
FullScreenOnDoubleClick="{Binding IsChecked, ElementName=FullOnDoubleClick}"
FullScreenOnMaximize="{Binding IsChecked, ElementName=FullOnMaximize}"
RestoreOnEscape="{Binding IsChecked, ElementName=ExitOnEscape}"/>
</i:Interaction.Behaviors>

<Viewbox Stretch="Uniform">

<Grid Width="640" Height="480">

<StackPanel Margin="20">

<TextBlock Text="Full Screen Demo" FontSize="32" />

<TextBlock TextWrapping="Wrap">

<LineBreak />
<LineBreak />

<Run>
The FullScreenBehavior makes it easy to create a WPF window that can &quot;go full screen&quot;.
By default, the full screen setting can only be changed programmatically. Try pressing the
ToggleButton in the upper right hand corner which is Two-Way bound to the IsFullScreen
property of the Window.
</Run>

<LineBreak />
<LineBreak />

<Run>
This demo uses a ViewBox to scale the content with the Window but that is not required.
You can use whatever layout strategy you want.
</Run>

<LineBreak />
<LineBreak />

<Run>
There are properties that can be set that can be used to enable automatic full screen behavior
in response to common user actions. Play around with the options below which control how the
Window reacts to user gestures.
</Run>

<LineBreak />

</TextBlock>

<CheckBox x:Name="FullOnMaximize" Margin="5" Content="Maximizing enters full screen"/>
<CheckBox x:Name="FullOnDoubleClick" Margin="5" Content="Double clicking enters/exits full screen" />
<CheckBox x:Name="ExitOnEscape" Margin="5" Content="Pressing escape exits full screen"/>

</StackPanel>

<ToggleButton x:Name="FullScreenButton" Content="Full Screen"
Margin="8" VerticalAlignment="Top" HorizontalAlignment="Right"
Height="50" Width="120" Checked="FullScreenButton_Checked"/>

</Grid>

</Viewbox>

</Window>

我将代码更新为完整的 XAML 代码。我最初发布了相关部分,但我根据要求发布了整个代码。

我看到没有使窗口FullScreen 的“代码”。我的问题是它如何使窗口“全屏”?

最佳答案

I found some code and I was wondering if someone can explain how it works

没有人可以,因为您错过了 Einstein::FullScreenBehavior 的行为

行为是自定义 XAML 元素,您错过了代码 - 您只有页面中的集成。

这与启动无关,它执行一些按钮弹起和一些事件连接,除非选中 FullscrrenButton_Checked,否则不会说窗口全屏启动。

但要了解它是如何工作的,您需要向我们提供该行为的代码。

关于c# - 如何启动全屏应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14362982/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com