Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ToolTips bindings to items not working (Read 161 times)
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
ToolTips bindings to items not working
Dec 6th, 2024 at 11:51am
Print Post  
Hello MindFusion team!
I use custom tooltip data in my application. I mentioned that after 4.0 version diagram items styles are still applied, but data context property is not being retrieved for the tooltip. I've attached these two projects to show how it works. Question is, how can I bind to DiagramItem in newer version?
  

TooltipBeforeUpdate.zip ( 437 KB | 14 Downloads )
ToolTipAfterTheUpdate.zip ( 438 KB | 19 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: ToolTips bindings to items not working
Reply #1 - Dec 9th, 2024 at 6:54am
Print Post  
Hi there,

Code
Select All
<ToolTip x:Key="ItemToolTip"
        DataContext="{Binding Path=PlacementTarget, RelativeSource={x:Static RelativeSource.Self}}">
    <TextBlock Text="{Binding CustomData}"/>
</ToolTip> 



Relying on PlacementTarget being a diagram item will not work anymore with v4's presenter-based implementation. New diagram build here sets DataContext automatically to the item -

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.1.4

so this Xaml should be enough now -

Code
Select All
<ToolTip x:Key="ItemToolTip">
	<TextBlock Text="{Binding CustomData}"/>
</ToolTip>
 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
Re: ToolTips bindings to items not working
Reply #2 - Dec 12th, 2024 at 6:35am
Print Post  
This solution worked for me, thank you!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint