Reputation: 9923
How can I have have one element forward the mouse events to another element?
I would like to simulate a margin that forwards events to the content. In the following example, r1 is the margin and r2 is the content.
<DockPanel>
<Rectangle DockPanel.Dock='Left' Name="r1" MouseLeftButtonDown="r1Down"/>
<Rectangle Name="r2" MouseLeftButton="r2Down"/>
</DockPanel>
What I would like to do is
r1Down (object sender, object args)
{
//raise event for r2 where mouse position.X = 0
}
Upvotes: 3
Views: 2829
Reputation: 10383
To simply "forward" the event to r2, you can do the following:
r1Down (object sender, object args)
{
r2.RaiseEvent(args);
}
I'm not sure what you meant by "where mouse position.X = 0" in your comment though.
Upvotes: 9