Click here to Skip to main content
15,895,142 members
Articles / Desktop Programming / WPF

WPF Introduction: Databinding + Styles + IValueConverter

Rate me:
Please Sign up or sign in to vote.
4.20/5 (12 votes)
5 Aug 2009CPOL5 min read 79K   939   23  
A small introduction about Listview Databinding and Styles with introduction to IValueConverter interface
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ListViewDataBindingSample
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            List<EmployeeData> employeeDataList = new List<EmployeeData>();
            EmployeeData e1 = new EmployeeData(3809, "Sathish Kumar", "Application Developer", false, 28);
            EmployeeData e2 = new EmployeeData(3810, "Ambalavanar", "Senior Application Developer", false, 28);
            EmployeeData e3 = new EmployeeData(2783, "Raghuraman", "Senior Application Developer", false, 26);
            EmployeeData e4 = new EmployeeData(2157, "Balasubramaninan", "Project Leader", false, 34);
            EmployeeData e5 = new EmployeeData(3151, "Raja Natarajan", "Development Manager", true, 37);
            employeeDataList.Add(e1);
            employeeDataList.Add(e2);
            employeeDataList.Add(e3);
            employeeDataList.Add(e4);
            employeeDataList.Add(e5);

            lsvElements.ItemsSource = employeeDataList;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Team Leader
India India
Working in a software development company specializing financial products as Senior Developer. Interested in WPF, WCF, C# and C.

Comments and Discussions