【发布时间】:2010-07-12 12:06:36
【问题描述】:
所以我有一个列表框:
<ListBox Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"> //<----Item's Data Source Method Call Here?
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel
Orientation="Horizontal"
IsItemsHost="true" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Orientation="Vertical">
<Label Content="{Binding Address1}"></Label>
<Label Content="{Binding Address2}"></Label>
<Label Content="{Binding Town}"></Label>
<Label Content="{Binding Postcode}"></Label>
<Label Content="{Binding Country}"></Label>
<CheckBox Content="{Binding Include}"></CheckBox>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
我想做的是将项目的数据源设置为地址列表,所有这些地址都具有相同的邮政编码。所以我需要一个具有相同邮政编码的 Observable Collection 中的当前地址列表。要生成这样的地址列表,只需调用接受当前邮政编码作为参数的方法,但我不知道如何调用需要来自静态数据源的参数的方法。
谁能帮忙?
【问题讨论】:
标签: c# xaml datasource