【发布时间】:2012-11-15 09:42:09
【问题描述】:
属性 MaxHeight 在 RowDefinitions 上似乎被 Height="Auto" 忽略:
考虑以下 XAML:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MaxHeight="100"/>
</Grid.RowDefinitions>
<ListBox>
<ListBox.Items>
<ListBoxItem>a</ListBoxItem>
<ListBoxItem>b</ListBoxItem>
<ListBoxItem>c</ListBoxItem>
<ListBoxItem>d</ListBoxItem>
<ListBoxItem>e</ListBoxItem>
<ListBoxItem>f</ListBoxItem>
<ListBoxItem>g</ListBoxItem>
<ListBoxItem>h</ListBoxItem>
<ListBoxItem>i</ListBoxItem>
<ListBoxItem>j</ListBoxItem>
</ListBox.Items>
</ListBox>
</Grid>
网格将大于 100 dip。
如何限制 RowDefinition 的高度?
【问题讨论】:
-
您使用什么版本的 .NET?
-
.NET 4 在当前项目中。但如果 .NET 4.5 中有新内容,我也想听听。
-
顺便说一句,刚刚发现这个小曲子似乎可以解决您的问题stackoverflow.com/questions/3294368/… 即使用“快捷方式”Height="*"