Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram link margin where the link fired the mouse over / click events (Read 4289 times)
Kostya
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Aug 5th, 2014
Diagram link margin where the link fired the mouse over / click events
Jan 15th, 2015 at 1:49pm
Print Post  
Hi,

In the WinForms version, we had a margin around the link where it fired the events. In the WPF version user have to click exactly on that 1-pixel wide link. Is it possible to return back this behavior?

Thanks,
-Kostya
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram link margin where the link fired the mouse over / click events
Reply #1 - Jan 15th, 2015 at 6:11pm
Print Post  
Hi,

That depends on the Diagram.LinkHitDistance property; check if you haven't set it to a small value.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kostya
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Aug 5th, 2014
Re: Diagram link margin where the link fired the mouse over / click events
Reply #2 - Jan 16th, 2015 at 10:02am
Print Post  
Thanks Stoyan, one clarification then: I actually need to open the popup menu on the link but not to aim at the 1px line. So the LinkHitDistance helps to select a link by clicking. But the problem is that I would like to open the link context menu, with right mouse button, so that the line isn't selected in this way.

-Kostya
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram link margin where the link fired the mouse over / click events
Reply #3 - Jan 16th, 2015 at 12:27pm
Print Post  
LinkHitDistance is also considered when raising LinkClicked event, so you could show the context menu from LinkClicked handler:

Code
Select All
private void OnLinkClicked(object sender, LinkEventArgs e)
{
	if (e.MouseButton == MouseButton.Right)
	{
		var contextMenu = new ContextMenu();
		...
		contextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse;
		contextMenu.IsOpen = true;
	}
} 



If you use WPF's FrameworkElement.ContextMenu property, it will show only when you click pixels rendered by the link indeed. In such case try showing it from LinkClicked handler too:

Code
Select All
...
e.Link.ContextMenu.IsOpen = true;
... 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kostya
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Aug 5th, 2014
Re: Diagram link margin where the link fired the mouse over / click events
Reply #4 - Jan 19th, 2015 at 10:08am
Print Post  
Stoyan, thank you, it works!
Can I expect to see the Diagram.LinkHitDistance property as a DependencProperty, to use in styles?
  
Back to top
 
IP Logged
 
Kostya
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Aug 5th, 2014
Re: Diagram link margin where the link fired the mouse over / click events
Reply #5 - Jan 26th, 2015 at 11:49am
Print Post  
Stoyan, sorry: all the same, can you please let me know about the possibility of adding this as a DependencProperty?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram link margin where the link fired the mouse over / click events
Reply #6 - Jan 27th, 2015 at 11:51am
Print Post  
It's a dependency property in this build:
https://mindfusion.eu/_beta/wpfdiag321.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kostya
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Aug 5th, 2014
Re: Diagram link margin where the link fired the mouse over / click events
Reply #7 - Jan 27th, 2015 at 1:39pm
Print Post  
It is good to know, thanks Stoyan!
-Kostya
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint