none
HOw to make a checkBox readonly in WPF??

Answers

  • If you don't need to process any user clicks on the CheckBox, setting IsHitTestVisible="false" should work.

     

    • Marked as answer by BS-786 Friday, May 30, 2008 10:31 PM
    Thursday, May 29, 2008 10:06 PM

All replies

  • If you don't need to process any user clicks on the CheckBox, setting IsHitTestVisible="false" should work.

     

    • Marked as answer by BS-786 Friday, May 30, 2008 10:31 PM
    Thursday, May 29, 2008 10:06 PM
  • You can simply set IsEnabled property of your CheckBox to "false".
    Kind regards, Denis (GMT +02:00)
    • Proposed as answer by Denis Vuyka Friday, May 30, 2008 7:38 PM
    Friday, May 30, 2008 7:13 PM
  • Ben Ronco - MSFT said:

    If you don't need to process any user clicks on the CheckBox, setting IsHitTestVisible="false" should work.

     



    Saying "readonly" checkbox I guess means that the user shouldn't provide any changes to it's state due to some business or application rules. Denying hit testing means the user won't be able clicking the checkbox with a mouse but he's still able moving a keyboard focus there by Tab and changing the values using the Space bar. Again would stress that it is better using "IsEnabled" property if the application is sensitive to checkbox value and should have possibility making it readonly.
    Kind regards, Denis (GMT +02:00)
    Saturday, May 31, 2008 12:08 PM
  • You can set IsHitTestVisible AND Focusable to false
    This way the user cannot change the checkbox state, neither with the mouse or the keyboard
    • Proposed as answer by Kelly Luck Tuesday, May 31, 2011 2:53 PM
    Tuesday, November 18, 2008 2:38 AM
  • Thanks Thomas for your nice advice.
    Tuesday, June 15, 2010 10:24 AM
  • Perfect! Thanks Thomas, that is exactly what I was looking for! Setting IsEnabled makes the box grayed out which is definintely not what I want to do. Good idea but definitely not acceptable in my case. This is just perfect! I've been searching for this answer. Thanks for the help!
    Thursday, November 04, 2010 7:51 PM
  • Both options will kill the tool tip. How to maintain tool tip alive, and forbid any editing?
    Wednesday, September 28, 2011 1:37 PM