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;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls.GridView;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();

            DataContext = new MyDataContext();
        }

        private void RadGridView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
        {
            var row = e.Row as GridViewRow;
            if (row != null)
            {
                var item = row.DataContext as MyObject;
                if (item != null && item.Property1 == 0)
                {
                    row.IsEnabled = false;
                }
            }
        }
    }

    public class MyDataContext
    {
        ObservableCollection<MyObject> _Data;
        public ObservableCollection<MyObject> Data
        {
            get
            {
                if (_Data == null)
                {
                    _Data = new ObservableCollection<MyObject>(
                        from i in Enumerable.Range(0, 100)
                        select new MyObject()
                        {
                            Property1 = i % 10,
                            Property2 = String.Format("Property2{0}", i),
                            Property3 = String.Format("Property3{0}", i),
                            Property4 = String.Format("Property4{0}", i),
                            Property5 = String.Format("Property5{0}", i)
                        });
                }
                return _Data;
            }
        }
    }

    public class MyObject
    {
        public int Property1 { get; set; }
        public string Property2 { get; set; }
        public string Property3 { get; set; }
        public string Property4 { get; set; }
        public string Property5 { get; set; }
    }
}
