【发布时间】:2018-07-21 12:07:17
【问题描述】:
<ItemsControl>
<ItemsControl.Resources>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="Command" Value="{Binding MyCommand}"/>
<Setter Property="CommandParameter" Value="{Binding RelativeSource={Problem}, Path=Content}"/>
</Style>
</ItemsControl.Resources>
<RadioButton Content="1"/>
<RadioButton Content="2"/>
<RadioButton Content="3"/>
<RadioButton Content="4"/>
<RadioButton Content="5"/>
<RadioButton Content="6"/>
</ItemsControl>
我想将每个 RadioButton 的 CommandParameter 设置为其内容。 我应该使用哪个 RelativeSource?
【问题讨论】:
标签: c# wpf binding itemscontrol