Hello,
The easiest way will be to create your own column and apply desired logic - in this case bind IsEnabled property of the CheckBox:
XAML
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;
using Telerik.Windows.Controls;
using System.Collections.ObjectModel;
using Telerik.Windows.Data;
using Telerik.Windows.Controls.GridView;
using System.Text;
using System.IO;
using System.ComponentModel;
namespace SilverlightApplication1
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
DataContext = (from i in Enumerable.Range(0, 100)
select new MyObject() { Property1 = i, Property2 = false }).ToList();
}
}
public class MyObject : INotifyPropertyChanged
{
int _Property1;
public int Property1 { get { return _Property1; } set { if (_Property1 != value) { _Property1 = value; OnPropertyChanged("Property1"); } } }
bool _Property2;
public bool Property2 { get { return _Property2; } set { if (_Property2 != value) { _Property2 = value; OnPropertyChanged("Property2"); } } }
#region INotifyPropertyChanged Members
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
public class MyGridViewSelectColumn : GridViewSelectColumn
{
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
{
var element = base.CreateCellElement(cell, dataItem);
var checkBox = element as CheckBox;
if (checkBox != null)
{
checkBox.SetBinding(CheckBox.IsEnabledProperty, new Binding("Property2") { Source = dataItem });
}
return element;
}
}
}
You can check also the attached application.
Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items.