0
リストボックスは、Choicesというビューモデルプロパティにバインドされています。各選択肢にはラベルと索引があります。リスト内のボタンを同じビューモデル上のコマンドにバインドする必要があります。これまでのところ、アイブ氏は、このくらいの考え出し:ボタンと相対ソースのリストボックス
<ListBox Grid.Row="1" ItemsSource="{Binding Choices}" SelectedIndex="{Binding SelectedChoice, Mode=TwoWay}" >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch" Margin="1">
<Button Content="{Binding Caption}" Height="24" HorizontalAlignment="Stretch"
Command="{Binding RelativeSource={RelativeSource ???},
Path=SelectChoice}" CommandParameter="{Binding}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
私はRelativeSourceは、コマンドで使用するかを把握カントと私はCommandParameterが正しいかはわかりません。
これは本当に簡単なことですが、私の貧しい古い脳にとっては明らかに単純すぎます。誰でも助けてくれますか?
おかげ