Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic DiagramLink Style not getting applied (Read 257 times)
Joel D.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 47
Location: Vancouver, Canada
Joined: Feb 6th, 2017
DiagramLink Style not getting applied
Oct 1st, 2026 at 8:02pm
Print Post  
I recently updated to 4.4.1 of Diagramming.Wpf.

I have a default Style for DiagramLinks set in my UserControl's Resources section in XAML. Before updating (I was previously on 4.1.14) the default Style would be applied to the DiagramLink as the link was being drawn from one node to another.

After the update to 4.4.1 however, the link has its default settings while being drawn, and only takes my default Style once it has been created.

Placing a breakpoint in the DiagramView's MouseMove event and checking for Interaction being Create, I can see that the CurrentItem when cast to a DiagramLink has its Style as null, when previously the Style would be non-null.

I also tried setting the DiagramLinkStyle property on the Diagram to a Style, but that didn't seem to work either.

Is there something new in 4.4.1 that I need to do to get the DiagramLink's Style to take affect while the link is being created?

Thanks!
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3529
Joined: Oct 19th, 2005
Re: DiagramLink Style not getting applied
Reply #1 - Oct 2nd, 2026 at 12:00pm
Print Post  
It seems the diagram isn't adding new items to the WPF logical tree (through which styles are inherited) until user finishes drawing. For time being you can work around it by adding a key to the style and setting link.Style explicitly:

Code
Select All
void OnInitializeLink(object sender, LinkEventArgs e)
{
    e.Link.Style = (Style)FindResource("linkStyle");
}

void OnLinkCreated(object sender, LinkEventArgs e)
{
    // back to inheriting the style from logical tree
    e.Link.ClearValue(FrameworkElement.StyleProperty);
    Debug.WriteLine($"Created DiagramLink - Style: {e.Link.Style}, Stroke: {e.Link.Stroke}");
} 



Our developer couldn't find difference in logical tree handling between 4.1 and 4.4 versions, but if you've just now migrated to DiagramView from the deprecated Diagram UI control approach, it could be an older bug - we'll investigate it further next week.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3529
Joined: Oct 19th, 2005
Re: DiagramLink Style not getting applied
Reply #2 - Oct 7th, 2026 at 1:50pm
Print Post  
This build should add the link to WPF logical tree as soon as you start drawing with the mouse -

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.4.2-beta1

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint