Click here to Skip to main content
15,878,430 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Please Help me To create customized a gridview with template from this data which is given below and the WPF xml view is given below just under the code.



C#
public partial class MainWindow : Window
    {
        List<Employeedata> Employeedatalist = new List<Employeedata>();
        public MainWindow()
        {
            InitializeComponent();
            List<PhotoData> photoDatas1 = new List<PhotoData>();
            photoDatas1.Add(new PhotoData() { ID = 1, Name = "Lighthouse", Path = "/Lighthouse.jpg" });
            photoDatas1.Add(new PhotoData() { ID = 2, Name = "Jellyfish", Path = "/Jellyfish.jpg" });


            List<PhotoData> photoDatas2 = new List<PhotoData>();
            photoDatas2.Add(new PhotoData() { ID = 1, Name = "Chrysanthemum", Path = "/Chrysanthemum.jpg" });
            photoDatas2.Add(new PhotoData() { ID = 2, Name = "Koala", Path = "/Koala.jpg" });


            List<PhotoData> photoDatas3 = new List<PhotoData>();
            photoDatas3.Add(new PhotoData() { ID = 1, Name = "Hydrangeas", Path = "/Hydrangeas.jpg" });
            photoDatas3.Add(new PhotoData() { ID = 2, Name = "Lighthouse", Path = "/Lighthouse.jpg" });
            photoDatas3.Add(new PhotoData() { ID = 2, Name = "Jellyfish", Path = "/Jellyfish.jpg" });


            Employeedatalist.Add(new Employeedata { ID = 1, Photos = photoDatas1, Name = "My name" });
            Employeedatalist.Add(new Employeedata { ID = 2, Photos = photoDatas2, Name = "Fahad" });
            Employeedatalist.Add(new Employeedata { ID = 3, Photos = photoDatas3, Name = "Abrar" });
            dg_SmeAFe.ItemsSource = Employeedatalist;
        }


    }

    public class Employeedata
    {
        public int ID { get; set; }
        public List<PhotoData> Photos { get; set; }
        public string Name { get; set; }
    }

    public class PhotoData
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Path { get; set; }
    }


--------------------------------------------------------------
| ID | Name       | Photos                                   |
--------------------------------------------------------------
| 1  | Emp name1  | Photo1.1  -   Photo Name 1.1             |
|    |            | Photo1.2  -   Photo Name 1.2             |
--------------------------------------------------------------
| 2  | Emp name2  | Photo2.1  -   Photo Name 2.1             |
|    |            | Photo2.2  -   Photo Name 2.2             |
--------------------------------------------------------------
| 3  | Emp name3  | Photo3.1  -   Photo Name 3.1             |
|    |            | Photo3.2  -   Photo Name 3.2             |
|    |            | Photo3.3  -   Photo Name 3.3             |
--------------------------------------------------------------
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900