2014-05-09 24 views
1

我將我的列表框的ItemsSource綁定到Event類的列表。 事件具有以下屬性:顯示列表框的多個成員路徑

Date 
Title 
Company 
Description 

我可以使用下面的線目前顯示這些屬性中的任意1:

<ListBox ItemsSource="{Binding FilteredEventsCollection}" DisplayMemberPath="Date"/> 

我要顯示所有的信息,請問我該怎麼辦那?

回答

5

利用Data Template到顯示列表框裏面不同的控件內的各種性質

<ListBox ItemsSource="{Binding FilteredEventsCollection}"> 
    <ListBox.ItemTemplate> 
     <DataTemplate> 
      <StackPanel> 
       <TextBlock Text="{Binding Date}" /> 
       <TextBlock Text="{Binding Title}" /> 
       <TextBlock Text="{Binding Company}" /> 
       <TextBlock Text="{Binding Description}" /> 
      </StackPanel> 
     </DataTemplate> 
    </ListBox.ItemTemplate> 
</ListBox> 
相關問題