allowing clicks on Button in ComboBoxItem when IsHitTestVisible is false

限于喜欢 提交于 2019-12-22 08:55:04

问题


alt text http://img375.imageshack.us/img375/9830/combobox.png

Setting the IsHitTestVisible="false" has the effect of having the whole ComboBox's drop area unresponsive to clicks. The same goes for setting to true.

With a ComboBox I don't have to create any storyboard to make ComboBox animation like but I found this issue.

How can one make the ComboBoxItem area unclickable except for the button within?


回答1:


Sounds like you should be creating a custom control that uses a popup window, that just looks like a combobox, however you can do what you wanted:

  • Put your buttons inside a grid, inside a single RadComboBoxItem
  • Set the grid background colour to 1% alpha so it is hit-test visible yet unseen
  • Add a Grid_MouseLeftButtonUp event handlern to the grid
  • In the handler set e.Handled to true so the mouse up is eaten

Make sure you close the combobox popup when you get your button presses.

Hope this helps.



来源:https://stackoverflow.com/questions/3234650/allowing-clicks-on-button-in-comboboxitem-when-ishittestvisible-is-false

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!