Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1585
Style XamTreeItem
posted

I am data binding my XamTree and I am using a DataTemplate for presentation.

I would like to set the Visibility property for each XamTreeItem based on the object that it is binding to.

I tried this...

<Style x:Name="XamTreeExpandedNodes" TargetType="igTree:XamTreeItem">
        <Setter Property="Visibility" Value="{Binding Visible}"/>
 </Style>

 

I get a runtime error, just saying its not valid... Is there any way to do this?

 

 

  • 40030
    Verified Answer
    Offline posted

    Hi, 

    In Silverlight, you can not using Bindings in Styles. 

    However for that exact reason, we expose a property Called DefaultItemsContainer, that is of type DataTemplate. In that property, you must specify a XamTreeItem as the root item of the DataTemplate, however, you can then specify any bindings you want on the item, and we will use that as the item that will be generated when bind to yoru ItemSource. 

    Hope this helps, 

    -SteveZ