First of all, if you hassle is not having a
Click
event in the class
System.Windows.Controls.ProgressBar
, this is not a good excuse for crafting such an unnatural and ugly workaround as working with the click of a progress bar's container. No wonder, it's hard to do smoothly.
Instead, "compose" the click event out of available mouse events, such as
MouseUp
and
MouseDown
. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.controls.progressbar_events%28v=vs.110%29.aspx[
^].
For some background:
After all, why would the author of the
ProgressBar
would provide
Click
event, if the click is not needed for its functionality? Remember that
Click
(in other controls, such as
Button
) is the "logical" event which does not imply physical mouse event, could be done with the keyboard. In contrast to that, mouse and keyboard events are "raw" events inherited from
System.Windows.UIElement
:
http://msdn.microsoft.com/en-us/library/system.windows.uielement(v=vs.110).aspx[
^].
As soon as you need more abstract (logically higher-level) events, you introduce
Click
and whatever else.
—SA