Aru*_*n D 2 c# wpf xaml wpf-controls
我已经在这个窗口中创建了主窗口,创建了停靠面板,用于在主窗口中绑定用户控件值,如下所示,
<Window x:Class="WpfApplication2.DMMainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ResizeMode="NoResize"
WindowState="Maximized"
WindowStyle="None"
WindowStartupLocation="CenterScreen"
Height="{Binding SystemParameters.PrimaryScreenHeight}"
Width="{Binding SystemParameters.PrimaryScreenWidth}">
<DockPanel Width="1254" Height="1200" HorizontalAlignment="Left" Margin="0,0,0,0" x:Name="mainPanel" VerticalAlignment="Top" />
</Window>
Run Code Online (Sandbox Code Playgroud)
在此代码中,您可以看到停靠面板的给定宽度和高度。我需要这个高度和宽度需要绑定为与窗口宽度相同。我使用了实际的宽度和高度以及大小到内容,但没有发生预期的情况。请提出您的建议。
由于您使用的是停靠面板,因此无需显式设置它。如果您需要,您可以通过使用最小高度和宽度来进一步限制,但不是强制性的。
<Window x:Class="WpfApplication2.DMMainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ResizeMode="NoResize"
WindowState="Maximized"
WindowStyle="None"
WindowStartupLocation="CenterScreen"
Height="{Binding SystemParameters.PrimaryScreenHeight}"
Width="{Binding SystemParameters.PrimaryScreenWidth}">
<DockPanel x:Name="mainPanel"
MinHeight ="{Binding SystemParameters.PrimaryScreenHeight}"
MinWidth ="{Binding SystemParameters.PrimaryScreenWidth}" />
</Window>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4332 次 |
最近记录: |