Hi,
I need to bind the visibility property of XamDataTree NodeLayout to a property within the items collection. I need to control the visibility of a node dependeing on whether the property is true/false for that item within the collection.
However, the binding does not seem to work. Any help would be highly appreciated.
Thanks
Pallavi
Hello Pallavi,
Thank you for your post. I have been looking into it, but it seems like that I am missing something in your scenario, so if this is still an issue for you, could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Seems prety clear to me, as I have the same problem :
How to bind the Visibility property of a NodeLayout (in a XamDataTree), to a property of the underlying data ?
Hello Fabien,
I am requesting sample project, becasue I cannot be completely sure how your Data is organized and where the Property which you want to bind the Layout's Visibility to is defined and to which object it belongs.
Ok, here's the solution I found :
Add a property in data class MyDataClass :
public bool IsVisible { get; set; }Add ref to igPrimitives at the top of xaml :
xmlns:igPrim="http://schemas.infragistics.com/xaml/primitives"Create a dynamic style :
<UserControl.Resources> <igPrim:BoolToVisibilityConverter x:Key="BoolToVisibility"/> <Style TargetType="{x:Type ig:XamDataTreeNodeControl}" x:Key="NodeStyle"> <Setter Property="Visibility" Value="{Binding Node.Data.IsVisible, Converter={StaticResource BoolToVisibility}}" /> </Style></UserControl.Resources>Add style to every NodeLayout :<ig:NodeLayout TargetTypeName="MyDataClass" DisplayMemberPath="Name" Key="DataNode" NodeStyle="{StaticResource NodeStyle}">...</ig:NodeLayout>Every node checks the property IsVisible of the data an apply it to Visibility :-)
Thanks for the solution Fabien, it works :)