For example, I get this compiler warning,
The event ‘Company.SomeControl.SearchClick’ is never used.
But I know that it’s used because commenting it out throws me like 20 new warnings of XAML pages that are trying to use this event!
What gives? Is there a trick to get rid of this warning?
This appears to be warning 67 and can thus be suppressed with:
Don’t forget to restore it as soon as possible (after the event declaration) with:
However, I’d check again and make sure you’re raising the event somewhere, not just subscribing to it. The fact that the compiler spits out 20 warnings and not 20 errors when you comment out the event is also suspicious…
There’s also an interesting article about this warning and specifically how it applies to interfaces; there’s a good suggestion on how to deal with “unused” events. The important parts are: