【发布时间】:2015-04-29 18:00:48
【问题描述】:
我正在使用 WPF UniformGrid 来绑定项目列表,xaml 是这样的
<ListBox Name="lviewSearch" ItemsSource="{Binding SearchSettingsCollection}" SelectionMode="Multiple">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="2"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<ItemsControl Margin="3" Padding="5">
<DockPanel>
<Label Content="{Binding Label}" HorizontalAlignment="Stretch" Cursor="Hand" />
</DockPanel>
</ItemsControl>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
但是如果项目的数量较少,那么行之间的间距就太像这样了 http://i.stack.imgur.com/Xr5qy.png
我怎样才能减少这种情况?
【问题讨论】:
标签: c# wpf uniformgrid