を使用して定義されたリスト ビューがありますItemsSource。はItemsSource、ローカル クラス タイプのリストです。選択したアイテム
として送信する必要があります。CommandParameterDataType
誰かがこれで私を助けることができますか?
コード: (このコードは App.xaml にあり、データ テンプレートは itemsTemplate タグ内にあります)
<Application.Resources>
<DataTemplate x:Key="xxx" DataType="BL:DeviceInfo">
<StackPanel>
<Button Command="{Binding DataContext.SelectDeviceCommand RelativeSource={RelativeSource ancestorType=ListView}} CommandParameter="{???????}" />
</StackPanel>
</DataTemplate>
</Application.Resources>
SelectedItem を Deviceinfo として送信します。これは、リスト ビューのアイテム ソースであるリストのアイテムのタイプです。