开发者

WPF disable click on ComboBoxItem

I have a ComboBoxItem that acts strictly as a section title. Visually, I have it set but how do开发者_如何学Go I eat the click when something is selected?

I would prefer to accomplish this in xaml, if possible. TIA


You should be able to accomplish this by using the 'IsEnabled' property on the ComboBoxItem. In my quick test, this:

<ComboBox>
    <ComboBoxItem>Item1</ComboBoxItem>
    <ComboBoxItem IsEnabled="False">Item2</ComboBoxItem>
    <ComboBoxItem>Item3</ComboBoxItem>
</ComboBox>

Results in a ComboBox with 3 items, and "Item2" does not get selected when clicked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜