C#中带有静态参数的DynamicSource?
我正在尝试创建一个无边界的wpf应用程序,我发现这段代码C#中带有静态参数的DynamicSource?,c#,wpf,C#,Wpf,我正在尝试创建一个无边界的wpf应用程序,我发现这段代码 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http:/
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
x:Class="VSM.Window2"
x:Name="Window"
Title="Window2"
Width="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}"
Height="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}"
WindowStartupLocation="CenterScreen" AllowsTransparency="True" WindowStyle="None"
>
<Grid x:Name="LayoutRoot">
<Rectangle Fill="White" />
</Grid>
</Window>
将使用wpf创建无边框窗口应用程序。
我想创建一个按钮,该按钮将运行这个最大化的应用程序。
使用此xaml代码:
Width="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}"
Height="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}"
请帮助我使用DynamicSource bla bla bla bla将宽度和高度转换为c#,这样我就可以通过编程实现这一点。编写代码(在从窗口派生的类中):
但是强>考虑(取决于你想要达到什么):
- 应用程序所在的当前显示(您必须导入一些WinAPI函数)
- SystemParameters.VirtualScreenWidth和SystemParameters.VirtualScreenHeight
- SystemParameters.FullPrimaryScreenWidth和SystemParameters.FullPrimaryScreenHeight
Width="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}"
Height="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}"
this.Width = System.Windows.SystemParameters.MaximizedPrimaryScreenWidth;
this.Height = System.Windows.SystemParameters.MaximizedPrimaryScreenHeight;