I was able to hide the link by adding binding to the Visibility property of the LinkPanel in the link’s DataTemplate but I think it will be better to change the Visibility of the Link itself and not its DataTemplate. The same for Node.
I’ve try to create the following styles but it did not work for me:
That’s right. That’s why you should set or data-bind the go:Part.Visible attached property. It automatically changes the value of Visibility appropriately. It’s also a boolean, so you don’t need to bother with converters.
Hello Walter,
I’ve successfully use go:Part.Visible on my node DataTemplate top visual element and the nodes are hide and show just right.
I fail to do so with Link DataTemplate.
I’ve add go<span =“s1”>:Part.Visible<span =“s1”>=“False” to the PipeTemplate in the Piping demo and the links are still there.
<span =“s1”>Setting the Visibility to Collapsed does the trick but I would like to be consistence with my templates.
<span =“s1”>
It did not solve the problem.
I think the problem is somewhere else.
I’m looking at the code with Reflector and you did great job of obfuscating it so I don’t have the exact method names, but Part class has internal abstract method that accept bool name vis. and Node class override this method and in some condition set the Visible attached property of the links attached to the node even though the bounded property had false in it the Visible attached property was true and the link was visible on the diagram.
I understand that the problem is that when a node is hidden it links should be hidden to - but if you put local value to Visible attached property it will override any bounded value, I think.
Are you trying to make a Link visible when either or both of the nodes it connects are not visible? That’s not the normal policy.
If so, perhaps the order matters – maybe the Link is in fact visible initially, but then making a connected node not visible causes the link to be made invisible.
Hi,
I have found a workaround by using the Visibility of the root visual element in the link data template.
The problem is that when we hide the links, move the nodes around and reshow the links sometime (I can’t repro it consistently yet) some links remain where the nodes where when we hide them.
I thought maybe there is a connection to the workaround we use to hide the links.
The Visible/Visibility bug I mentioned earlier has been fixed in version 1.3.
However, I have no idea about what bug, if any, you are referring to in your most recent posts.
I suggest you try the beta DLL with and without the work-around code in the PartManager that I suggested.
I was to quick to celebrate I’m afraid.
I can’t reproduce the problem in small project, yet, but I did find that when I bind both my node’s DataTemplate first element with go:Part.Visible={Binding Data.IsVisible} and also bind my link’s DataTemplate first element with go:Part.Visible={Binding Data.IsVisible} the links are not hide when the data of the link turn IsVisible to false.
Both my node data and link data class have plain-old-clr-property name IsVisible, with call to OnPropertyChanged.
When I remove the binding of the Part.IsVisible from the node DataTemplate the links are hide just fine. I looks like the binding between the link’s VisualElement (first element in the link’s DataTemplate) is removed and a local value of true is set to Part.Visible attached dependency property, but I still don’t know why.
Thank you and I hope I’ll have more information soon.
Ido.
I think the problem is that the normal visibility propagation that is performed is setting the Part.Visible property, thereby displacing the data binding that was established in the template.
Hi,
Thank you very much again walter for saving the day (more like the month with this issue).
If you can help me understand why binding both node and link DataTemplate Part.Visible properties fix the problem that cause the link’s Visible property to be always true it will be very nice.
Any way, both links and node are now visible and hidden appropriately.