我有一个简单的窗口,我希望有100%的宽度。我尝试了水平对齐的“拉伸”属性,但宽度仍然坚持到768。
<Window x:Class="WPF.View.MetroMsgBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MetroMsgBox" ShowInTaskbar="True"
WindowStyle="None" ResizeMode="NoResize"
FontFamily="Segoe UI" Background="{x:Null}"
AllowsTransparency="True"
Height="135" WindowStartupLocation="CenterScreen"
Deactivated="MetroMsgBox_OnDeactivated" HorizontalAlignment="Stretch" >
答案 0 :(得分:1)
你好,你可以尝试一下:
<Window x:Class="WPF.View.MetroMsgBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MetroMsgBox" ShowInTaskbar="True"
Name=_window
WindowStyle="None" ResizeMode="NoResize"
FontFamily="Segoe UI" Background="{x:Null}"
AllowsTransparency="True"
Height="135" WindowStartupLocation="CenterScreen"
Deactivated="MetroMsgBox_OnDeactivated" HorizontalAlignment="Stretch" >
InitializeComponent();
_window.Width = Screen.PrimaryScreen.Bounds.Width;