【发布时间】:2011-05-04 15:37:19
【问题描述】:
我在 xaml 中定义了一个 ItemsControl 控件,如下所示:
<ItemsControl BorderThickness="0" Name="SummaryList">
</ItemsControl>
在同一个 xaml 文件中,我为 ItemsControl 中的每个项目定义了以下 DateTemplate:
<DataTemplate DataType="{x:Type app:UpgradeItem}">
<StackPanel Orientation="Horizontal">
<Label Margin="5,5" Content="{Binding Path=ItemText,Mode=OneTime}" />
<Label Margin="5,5" Content="{Binding Path=FromVersion,Mode=OneTime}" />
<Label Margin="5,5" Content="{Binding Path=ToVersion,Mode=OneTime}" />
</StackPanel>
</DataTemplate>
我已将 ItemsControl 的 ItemSource 绑定到 UpgradeItems 的通用列表(即列表),并在执行期间以编程方式添加到此列表中。 ItemsControl 控件中的项目会正确填充,但列中的数据未对齐。如何修改它以使三个单独的列(ItemText、FromVersion 和 ToVersion)对齐?
TIA
【问题讨论】:
标签: c# wpf wpf-controls itemscontrol