【发布时间】:2014-04-30 06:19:52
【问题描述】:
所以我是 .NET 和 WPF 的新手,希望有人能告诉我我做错了什么。我有一个 WPF 应用程序,它基本上只是一个数据网格。对于我的生活,我无法弄清楚如何让 DataGrid 在父窗口更改大小时自动调整大小,而不必编写一堆代码来监视窗口调整大小事件。在 OS X/Cocoa/Interface Builder 上,这相当简单直接,我只能假设 WPF 具有类似的功能。
<Window x:Class="MyClass.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="358" Width="542">
<Grid>
<DataGrid x:Name="mydatagrid" ItemsSource="{Binding}" AutoGenerateColumns="true" Height="328" Width="534"/>
</Grid>
</Window>
【问题讨论】:
标签: wpf resize wpfdatagrid