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
399
How to set Collapse/Expand Icon to XamTreeItem in Code-Behind.
posted

Hi

I trying to set collapse/expand icon to xamTreeItem in code-behind.
(source code attached)

I want to acquire the icon from the resource dynamically and to set it.

XamTreeItem rootItem = new XamTreeItem();
rootItem.Header = "Root";
Image parentCollapsedIcon = this.Resources["collaspedParentIcon"] as Image;
Image parentExpandIcon = this.Resources["expandParentIcon"] as Image;

rootItem.CollapsedIcon = parentCollapsedIcon;
rootItem.ExpandedIcon = parentExpandIcon;

but ManagedRuntimeError has shown.
Is there an idea to solve this problem?

regards.