<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Name="W_win_rp" Background="Bisque" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="350" d:DesignWidth="525" SizeToContent="WidthAndHeight">
如何在运行时在代码中更改此设计宽度?
答案 0 :(得分:3)
设计宽度和高度适用于设计而非运行时
用于更改Window的宽度和高度,只需使用 this.Width和this.Height