0

我有一个ObservableCollection<testItem>,每个testItem人都有另一个ObvervableCollection<testData>

知道每个testData我想要的和来自ListItem的一些数据。目前我将列表设置为as但我只得到了.testItemtestDataObservableCollection<testItem>ItemsSourceitemsData

我能做些什么?

更新:

xml:

<ListBox Name="ResultList" ItemsSource="{Binding TankstellenItem}" >
 <ListBox.ItemTemplate>
   <DataTemplate>
     <Border BorderBrush="#FF3AACDF" BorderThickness="4">
       <StackPanel Orientation="Horizontal" 
                   Background="White" 
                   UseLayoutRounding="True" Tap="ItemIsClicked">
        <StackPanel Width="130" Orientation="Vertical" Margin="0,0,0,0">
            <Border BorderThickness="2" 
                    Background="#FF3AACDF" BorderBrush="White">
                   <TextBlock Text="{Binding PriceBigDigits}" 
                              FontFamily="Assets/Font.ttf#LCD" 
                              FontSize="25" TextAlignment="Center" />
            </Border>
           <TextBlock Text="{Binding FuelType}" 
                       TextAlignment="Center" 
                       FontSize="15" Foreground="Black"/>
           <TextBlock Text="{Binding UpdateDate}" 
                      TextAlignment="Center" 
                      FontSize="15" Foreground="Black" />
           <TextBlock Text="{Binding DistanceString}" 
                      TextAlignment="Center" 
                      FontSize="15" Foreground="Black"/>
       </StackPanel>
      <StackPanel Orientation="Vertical" Margin="10,0,0,0" Width="400">
         <TextBlock Text="{Binding Title}" 
                    FontSize="30" FontWeight="Bold" Foreground="Black"/>
         <TextBlock Text="{Binding Address}" FontSize="20" Foreground="Black" />
         <TextBlock Text="{Binding PLZCity}" FontSize="20" Foreground="Black" />
       </StackPanel>
  </StackPanel>
   </Border>
   </DataTemplate>
   </ListBox.ItemTemplate>
</ListBox>

比我有testItem:

public testItem{
DistanceString (string),
Title (string),
Addresse (string),
PLZCity (string),
itemDates (ObservableCollection<itemData>)}

和 itemData:

public itemData{
PriceBigDigits (string),
FuelType (string),
UpdateDate (string)
4

1 回答 1

1

如果我理解正确,您可能希望将 绑定itemDates到 aItemsControlItemsSource属性。因此,将您的第二个包裹StackPanel在.DataTemplateItemsControl

于 2012-10-26T20:02:35.620 回答