Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Set the events of the TextBox as a foreshadowing to control the ShapeNode (Read 2297 times)
JackPan
Full Member
***
Offline


I Love MindFusion!

Posts: 134
Joined: Apr 9th, 2020
Set the events of the TextBox as a foreshadowing to control the ShapeNode
Sep 21st, 2020 at 1:55am
Print Post  
Hi, there. Smiley

I set the MouseLeftButtonDown event or PreviewMouseLeftButtonDown event to textBoxW in the program, but it only responds to PreviewMouseLeftButtonDown. why?

Any assistance would be appreciated.

Cheers,

Jack
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Set the events of the TextBox as a foreshadowing to control the ShapeNode
Reply #1 - Sep 21st, 2020 at 7:30am
Print Post  
Hi,

Are you setting Handled to true in your Preview* event? This will stop bubbling and next event won't be raised. Or the event might be consumed somewhere else in the event chain. Why do you need to handle both anyway?

Regards,
Lyubo
MindFusion
  
Back to top
 
IP Logged
 
JackPan
Full Member
***
Offline


I Love MindFusion!

Posts: 134
Joined: Apr 9th, 2020
Re: Set the events of the TextBox as a foreshadowing to control the ShapeNode
Reply #2 - Sep 21st, 2020 at 7:43am
Print Post  
Thanks, Lyubo. Smiley

I did not set Handled to true in the Preview* event. For example:
private void textBoxH_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
isDragging = true;
clickPoint = e.GetPosition(this);
}

private void textBoxH_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
isDragging = true;
clickPoint = e.GetPosition(this);
}
The result will only respond to the Preview * event, I didn't handle both, I just want to know why this happens.

Best regards.
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Set the events of the TextBox as a foreshadowing to control the ShapeNode
Reply #3 - Sep 21st, 2020 at 7:46am
Print Post  
It could be that the textbox control is consuming the event internally. You can read more on the topic here: https://docs.microsoft.com/en-us/dotnet/desktop/wpf/advanced/routed-events-overv...

Regards,
Lyubo
  
Back to top
 
IP Logged
 
JackPan
Full Member
***
Offline


I Love MindFusion!

Posts: 134
Joined: Apr 9th, 2020
Re: Set the events of the TextBox as a foreshadowing to control the ShapeNode
Reply #4 - Sep 21st, 2020 at 8:53am
Print Post  
Thanks very much, Lyubo. Smiley

So that I have a deeper understanding of the routing events of the wpf control.

Best regards. Smiley Smiley Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint