2011-07-03 21 views

答えて

9
MyListBox.SelectedItems.Add(item1); 
MyListBox.SelectedItems.Add(item2); 
..... 
5

あなたは多くを説明していない、うまくいけば、あなたはこのWPFの道を行っている...

は、それらを選択しているあなたのListBoxItem sのスタイルを与えるあなたのデータ項目のIsSelectedプロパティを作成するたびにIsSelected

<ListBox.ItemContainerStyle> 
    <Style TargetType="ListBoxItem"> 
     <Setter Property="IsSelected" Value="{Binding IsSelected}"/> 
    </Style> 
</ListBox.ItemContainerStyle> 

次に、データ項目のプロパティを変更し、OnPropertyChangedイベントを発生させます。

関連する問題