Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#中带有静态参数的DynamicSource?_C#_Wpf - Fatal编程技术网

C#中带有静态参数的DynamicSource?

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:/

我正在尝试创建一个无边界的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://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;