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
2325
XamDataTree :: Icons in TreeViewItem
posted

Hi Team,

I need to show Icons in  the Tree View Item. My Requirement is as below.

I have a class Materials

public class Materials

{

     Public Int MaterialID{get;set;}

     public string MaterialName{get;set:}

    public observablecollection<Materials> submaterials {get;set;}

}

I have 5 Different Material ID's  Based on the Material ID I need to display an ICON next to MaterialName, to identify the material based on the   Icon.

In My XAML i did some thing like below which is static 

<ig:NodeLayout.ItemTemplate>

<StackPanel Orientation="Horizontal">
<Image Source="..\Images\folder_star.png"/>
<TextBlock Text="{Binding Data.MaterialName}" FontWeight="Bold" />
</stackPanel>

</ig:NodeLayout.ItemTemplate>

I need to change the Source based on the Material ID. 

Do you have any Examples of this Kind. 

Parents Reply Children