Pundia 0 Newbie Poster

Hi! I have a little question. I'm new to WPF, and I've been working with DevExpress, I'm with the TreeListControl right now.

How can I change the data format in a field?

Specifically, I have a string with the url or route of an image, and I want the tree to display the image instead of the string. How can I achieve this?

This is my XAML code so far:

<dxg:TreeListControl Name="treeList" ItemsSource="{Binding staff}">
            <dxg:TreeListControl.Columns>
                <dxg:TreeListColumn FieldName="Name" />
                <dxg:TreeListColumn FieldName="Position" />
                <dxg:TreeListColumn FieldName="Department" />
                <dxg:TreeListColumn FieldName="Photo" />
            </dxg:TreeListControl.Columns>
            <dxg:TreeListControl.View >
                <dxg:TreeListView Name="treeListView1" AutoWidth="True"
                                  KeyFieldName="ID" ParentFieldName="ParentID" />
            </dxg:TreeListControl.View>
</dxg:TreeListControl>

This is my class, is very simple, this is just for learning purposes.

        public class Persona
        {
            public int ID { get; set; }
            public int ParentID { get; set; }
            public string Name { get; set; }
            public string Position { get; set; }
            public string Department { get; set; }
            public string Photo { get; set; }
        }

A little from my data:

public static List<Persona> GetStaff()
        {
            string temp = "C:/logopizza.jpg";
            List<Persona> staff = new List<Persona>();
            staff.Add(new Persona() { ID = 1, ParentID = 0, Name = "Gregory S. Price", Department = "", Position = "President", Photo=temp });
            staff.Add(new Persona() { ID = 2, ParentID = 1, Name = "Irma R. Marshall", Department = "Marketing", Position = "Vice President", Photo = temp });
        . . .

I found this: http://demos.devexpress.com/ASPxTreeListDemos/Shaping/Templates.aspx
Is what I need, how to template the data (or template just one field), but that code is for ASP and I don't know how to apply that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.