質問

ItemsListViewコレクションは、実際のビジネス・オブジェクトが含まれています。私は、対応するListViewItem特定のビジネス・オブジェクトを取得するにはどうすればよい(SelectedItem)?

役に立ちましたか?

解決

あなたは本当に、ListViewの<のhref = "http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemcontainergenerator.aspx" のrelを使用する必要がある場合= "nofollowをnoreferrer"> ItemsContainerGenerator のプロパティ。しかし、あなたが頻繁に設定しないで逃げることができItemContainerStyleBinding S:

<ListView>
    <ListView.ItemContainerStyle>
        <Style TargetType="ListViewItem">
            <Setter Property="IsSelected" Value="{Binding IsSpecial}"/>
        </Style>
    </ListView.ItemContainerStyle>
</ListView>
基礎となるバインドされたオブジェクトのプロパティがListViewItem IsSpecialある場合は、

上記のXAMLでは、true sが選択されます。 /選択解除を選択すると、<=>プロパティを更新します。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top