How would I set an icon for each programatically?
I create a new XamWebTreeItem as follows...
XamWebTreeItem xamWebTreeItem = new XamWebTreeItem();xamWebTreeItem.Header = node.ItemName;
xamWebTreeItem.ExpandedIcon = ??
xamWebTreeItem.CollapsedIcon =??
I tried
StreamResourceInfo r = Application.GetResourceStream(new Uri("/SilverlightApp;component/Images/test.jpg", UriKind.Relative)); BitmapImage bmp = new BitmapImage(); bmp.SetSource(r.Stream); xamWebTreeItem.ExpandedIcon = bmp;
The image does not show up.
I can do this and the icon will show...
<igTree:XamWebTree.ExpandedIconTemplate> <DataTemplate> <Image Source="/SilverlightApp;component/Images/test.gif" /> </DataTemplate> </igTree:XamWebTree.ExpandedIconTemplate>
Instead of setting the CollapsedIcon and ExpandedIcon to an object of type BitmapImage, I set it to a object of type Image and it worked. Problem solved.