views:

54

answers:

3

I've got a UserControl which has an opacity of 0. At that state it shouldn't be clickable. How to disable/re-enable it?

A: 
Visibility: Collapsed
CommanderZ
A: 

Set HitTestVisible to false.

Like below this.IsHitTestVisible = false;

HTH

Avatar
+5  A: 

Opacity doesn't disable hit testing.

You disable hit testing several ways:

  1. The most obvious, set IsHitTestVisible=false on your UserControl
  2. Change visibility to hidden instead of Opacity=0
  3. Change Visibility to collapsed (NOTE: This will change the layout semantics, collapsed will NOT consume screen real estate so it is actually different behaviorally then Opacity=0)
Foovanadil