所以我有两个与第一列(TestID)相关的列表视图。当我在第一个列表视图中选择行时,我希望在第二个列表视图中自动选择该行。这就是我到目前为止所拥有的。
AutomationTestResults tr = new AutomationTestResults();
public int SelectedTestID
{
get
{
return tr.TestID;
}
set
{
tr.TestID = value;
NotifyPropertyChanged("SelectedTestID");
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(String propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
=============XAML===================================== =====================
<ListView ItemsSource="{Binding TRCollection }" SelectedItem="{Binding SelectedTestID}" SelectionChanged="ListView_SelectionChanged"
Grid.Row="1" Height="197" HorizontalAlignment="Left" Margin="12,22,0,0" Name="listView1" VerticalAlignment="Top" Width="680">
</ListView>
<ListView ItemsSource="{Binding TCCollection}" SelectedItem="{Binding SelectedTestID}" SelectionChanged="ListView_SelectionChanged"
Grid.Row="1" Height="245" HorizontalAlignment="Left" Margin="12,251,0,0" Name="listView2" VerticalAlignment="Top" Width="680" >