【发布时间】:2015-03-25 17:27:39
【问题描述】:
我有一个组合框,其中包含条目+操作列表作为文本和按钮:
[ Item #1 [Preview] v ]
| Item #2 [Preview] |
| Item #3 [Preview] |
| Item #4 [Preview] |
问题是用户只能单击下拉列表上的按钮,而不能单击所选项目。基本上任何点击 ComboCox 都会打开下拉菜单。
有没有办法将下拉菜单限制为仅 V 按钮?或者以其他方式使所选项目中的按钮可点击?
这是我的 XAML
<ComboBox ItemsSource="{Binding LayoutsList}" >
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" />
<Button
Command="{Binding PreviewCommand}"
CommandParameter="{Binding}"
>Preview</Button>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
【问题讨论】:
标签: wpf button combobox wpf-controls