Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Enable/ disable different parts of a control
1 replies. Latest Post by elmore.adam on July 3, 2009.
(0)
karlsson...
Member
1 points
77 Posts
06-30-2009 4:40 AM |
Hi
I have an app that contains different usercontrols. Sometimes I want to disable most part of the pages and just keep a couple buttons clickable. I tried to use both:
btn_Cancel.IsHitTestVisible =
and IsEnabled. But btn_Cancel is never reset, it has the of the whole control.
Isn't it possible to override that value? Do I really need to set all part to false instead?
Regards Katrin
elmore.adam
482 points
67 Posts
07-03-2009 3:10 PM |
First, you should use the IsEnabled property to disable elements on your view. Read more about IsEnabled and IsHitTestVisible to understand the differences; essentially, by setting the IsEnabled property to false you will allow controls to display their "Disabled" state, whereas setting IsHitTestVisible to false will simply remove the ability to interact with the controls with a mouse. You will probably want to give the end users some sort of visual hint that the controls aren't active. To answer your question, setting IsEnabled to false (or IsHitTestVisible for that matter) will affect all children elements. These are both properties of UIElement and as such you can set them on anything that derives from UIElement. Setting IsEnabled to false on the UserControl element would in turn disable all children elements on that view. No such override exists.