したがって、最初の列 (TestID) で関連付けられた 2 つのリスト ビューがあります。最初のリストビューで行を選択すると、2番目のリストビューで行が自動的に選択されるようにします。これは私がこれまでに持っているものです。
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" >