how to get input for transparent elements
Some elements in WPF are transparent by default (like Canvas) and for being transparent it doesn't get input events (mouse, keyboard). What is the correct way to get input events for these elements ? I know I can set a Background (event Brushes.Transparent) to workaround, but I don't want to change any default prorperty in the element if possible. I suppose I can subclass canvas and reimplement HitTestCore() but that is more work and I would like to do.
Thanks
Felipe
Thanks Anthony,
I would prefer not to touch the default background for the uielement, different themes can define different colors for background and for me is important to keep the right one.
here is example: I have a TabControl, inside of it I have group. The background of the TabControl depends on the theme (it can be grandient, solid gray, whatever). If I don't touch the backgrond of the group, in the normal case it is transparent showing the background of the tabcontrol thru. If the user sets the background of all group to red it will still work (since I never set the background of it).
I guess I can set the background to Transparent if only background == null.
Felipe