*******MAINPAGE.XAML.CS******** public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); button1.Click += new RoutedEventHandler(button1_Click); //disable grid button2.Click += new RoutedEventHandler(button2_Click); //enable grid button3.Click += new RoutedEventHandler(button3_Click); //readonly grid button4.Click += new RoutedEventHandler(button4_Click); //notreadonly grid button5.Click += new RoutedEventHandler(button5_Click); //columnreadonly grid button6.Click += new RoutedEventHandler(button6_Click); //columnnotreadonly grid LoadData(); } void button6_Click(object sender, RoutedEventArgs e) { ColumnsReadOnly(false); tb.Text = button6.Content.ToString(); } void button5_Click(object sender, RoutedEventArgs e) { ColumnsReadOnly(true); tb.Text = button5.Content.ToString(); } void button4_Click(object sender, RoutedEventArgs e) { IsReadOnly = false; tb.Text = button4.Content.ToString(); } void button3_Click(object sender, RoutedEventArgs e) { IsReadOnly = true; tb.Text = button3.Content.ToString(); } void button2_Click(object sender, RoutedEventArgs e) { grid.IsEnabled = true; tb.Text = button2.Content.ToString(); } void button1_Click(object sender, RoutedEventArgs e) { grid.IsEnabled = false; tb.Text = button1.Content.ToString(); } private void ColumnsReadOnly(bool isReadonly) { foreach (Column c in grid.Columns) { if ((c as TemplateColumn) != null) (c as TemplateColumn).IsReadOnly = isReadonly; if ((c as TextColumn) != null) (c as TextColumn).IsReadOnly = isReadonly; } } public bool IsReadOnly { get { if (grid.EditingSettings.AllowEditing == EditingType.Cell) { return false; } return true; } set {grid.EditingSettings.AllowEditing = value ? EditingType.None : EditingType.Cell; } } private void LoadData() { List objList = new List() { }; for (int i = 0; i <= 100; i++) { objList.Add(new Obj() { Name = i.ToString(), Template1 = i % 2 == 0, Template2 = i % 10 == 0 }); } grid.ItemsSource = objList; } } public class Obj { public string Name { get; set; } public bool Template1 { get; set; } public bool Template2 { get; set; } } ***************MAINPAGE.XAML*******