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
4155
How can i change icon for Nodes in XamDataTree depending on if the Node is expanded?
posted

As the question says, i want to use an image of an open folder if the node is expanded, and a closed folder if the node is not expanded.  I have a DataTemplate already, but can'tfigure out how to make a trigger for this that depends of the node's IsExpanded property.  Here's my existing XAML, showing an icon but without any code for switching the image source:

<igDT:NodeLayout Key="ReportFolder" TargetTypeName="ReportFolder" DisplayMemberPath="FolderName" >
                                            <igDT:NodeLayout.ItemTemplate>
                                                <DataTemplate>
                                                    <StackPanel Orientation="Horizontal" >
                                                        <Image Source="/Resources/Icons/closed_folder.png" /> //this is where I need a trigger to select open_folder.png if IsExpanded
                                                        <TextBlock Text="{Binding Data.FolderName}"/>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </igDT:NodeLayout.ItemTemplate>
                                        </igDT:NodeLayout>
Parents
No Data
Reply
  • 34430
    Verified Answer
    Offline posted

    Hello Travis,

    Rather than defining a NodeLayout.ItemTemplate, I would recommend that you look into the ExpandedIconTemplate and CollapsedIconTemplate values of the XamDataTree. If you set these to a DataTemplate with an Image inside, they will change based on whether the node is expanded or collapsed.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Developer Support Engineer I
    Infragistics Inc.
    www.infragistics.com/support

Children
No Data