Windows Vista Beta | WinVistaBeta.com - Message | DataBinding and ListView

September 07, 2008  
Subject: DataBinding and ListView
Group: microsoft.public.windows.developer.winfx.avalon
Date: 2/14/2008 1:04:26 PM
From: Lammert [Email Address Protection]

I have an application with two ListViews. The datasource of the
ListView is created with a converter (see XAML code). I use a
converter for the ListView for the following reason: when the selected
entity is an inactive entity: by default it isn't loaded into the
List. The converter add the inactive entity to the list with the
active entities. When I select a specific project in the first
ListView, the data in the second ListView must be reloaded and based
on the selected activity in the first ListView. How can I achieve this
in XAML? (The ListViews are nested in a DataTemplate)

<ListView Name="LstProjects" MaxHeight="200"
VerticalAlignment="Stretch"
ItemsSource="{Binding Mode=OneTime, ConverterParameter=Event.Project,
Path=Project, Converter={StaticResource projectDataSourceSelector}}"
SelectedItem="{Binding Project}">
</ListView>

<Label FontWeight="Bold">Project activity</Label>
<ListView Name="LstProjectActivities" VerticalAlignment="Stretch"
ItemsSource="{Binding Mode=OneTime,
ConverterParameter=Event.ProjectActivity,
Converter={StaticResource projectActivityDataSourceSelector}}"
SelectedItem="{Binding ProjectActivity}" MaxHeight="200">
</ListView>

Back