Display Images in  Tree View Nodes

Posted on 2012-08-30
Last Modified: 2012-09-04
Hi Experts,

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 x 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


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


I need to change the Image source based on the Material ID.

How can i accomplish This task ,,  Do i need to save the image paths in Database and based on the material ID , do i need to use Converter and  input path dynamically to image ?.

Any Ideas or sample code will be helpful. Thanks
Question by:B_Pati
    LVL 1

    Author Comment

    Hi ,
    Any Ideas on the above  scenario.
    LVL 23

    Accepted Solution

    LVL 23

    Expert Comment

    by:Roopesh Reddy

    Did the above link helped you?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now