Marutharasu P

Marutharasu P

  • NA
  • 51
  • 137.7k

DataGrid Row Background Color change programmatically

Apr 4 2014 12:12 AM
How to change selected row color dynamically in silverlight datagrid. I was trying this code but its notworking...

SampleConverter



bgConverter = new SampleConverter();



           


Binding binding = new Binding("IsChecked") { Mode = BindingMode.TwoWay, Converter = bgConverter, ValidatesOnExceptions = true };



           


DataGridRow objRow = GetDataGridRowByDataContext(dg, dg.SelectedItem);


           


if (objRow != null && objRow.IsValid)


            {


                objRow.SetBinding(


DataGridRow.BackgroundProperty, binding);


                objRow.UpdateLayout();


                dg.UpdateLayout();


            }


Answers (1)