1
我创建一个ListBoxItem行,每个都包含这3个项目:WPF DataTemplate的布局
1) Button
2) TextBox
3) CheckBox
我想他们这个样子,其中的复选框码头向右:
| 1 222 3 |
| 1 222222222 3 |
| 1 222222 3 |
但是相反我得到这个:
| 1 222 3 |
| 1 222222222 3 |
| 1 222222 3 |
这里是我的ItemTemplate:
<ListBox.ItemTemplate>
<DataTemplate x:Name="foo" DataType="{x:Type bar}">
<DockPanel LastChildFill="True">
<Button DockPanel.Dock="Left" />
<CheckBox DockPanel.Dock="Right" />
<TextBlock Text="Foo" />
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
诚然,我不完全理解StackPanels/DockPanels /网格之间的细微差别,但任何帮助,将不胜感激!
这样做。谢谢! – Matt 2013-03-06 19:26:48
@Matt没问题。 – 2013-03-06 19:31:43