<pre lang="xml"><Window x:Class="WpfApplication5.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit" Title="Window1" Height="450" Width="737" Loaded="Window_Loaded" xmlns:sys="clr-namespace:System;assembly=mscorlib"> <Window.Resources> <Style x:Key="alternatingListViewItemStyle" TargetType="{x:Type ListViewItem}"> <Style.Triggers> <Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Setter Property="Background" Value="LightBlue" /> </Trigger> <Trigger Property="ItemsControl.AlternationIndex" Value="1"> <Setter Property="Background" Value="#80EEEEEE" /> </Trigger> </Style.Triggers> </Style> </Window.Resources> <Grid Height="374" Width="554"> <dg:DataGrid MouseRightButtonUp="dgData_MouseRightButtonUp" AutoGenerateColumns="True" Margin="27,36,39,50" x:Name="dgData" RowHeight="25"> <dg:DataGrid.ContextMenu> <ContextMenu> <MenuItem Header="Add" Click="Ass_Lesson1"> </MenuItem> </ContextMenu> </dg:DataGrid.ContextMenu> </dg:DataGrid> </Grid> </Window
public partial class Window1 : Window { List<Employee> employeeList = new List<Employee>(); public class Employee { public string ICON { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string EmailID { get; set; } public string Contact { get; set; } } public Window1() { InitializeComponent(); for (int i = 1; i <= 5; i++) { Employee emp = new Employee { ICON = @"D:\play.png", FirstName = "FirstName" + i.ToString(), LastName = "LastName" + i.ToString(), EmailID = "FirstName " + i.ToString() + ".LastName" + i.ToString() + "@some.com", Contact = "9999999" + i.ToString() }; employeeList.Add(emp); } dgData.ItemsSource = employeeList; }
ICON = new URI(stringvalue,relativeorabsolute);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)