【发布时间】:2014-06-11 09:31:28
【问题描述】:
您好,我找不到任何类似的问题,所以我发布了新问题。在下面的代码中,我使用 ListBoxItems 创建 ListBox 控件,其中每个控件都包含单选按钮。当我单击单选按钮时,它会被选中,但父 ListBoxItem 不会(ListBoxItem 未突出显示)。我该如何解决这个问题?
<ListBox Margin="0, 5, 0, 0" ItemsSource="{Binding mySource, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" SelectionMode="Single">
<ListBox.ItemTemplate>
<DataTemplate>
<!-- Rabio template -->
<RadioButton GroupName="radiosGroup"
Margin="10, 2, 5, 2"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SelectedSetting}"
CommandParameter="{Binding SomeId, Mode=OneWay}"
Content="{Binding FileNameWithoutExtensions, Mode=OneWay}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
【问题讨论】:
标签: c# wpf xaml mvvm wpf-controls