1
Answer

DataGrid Row Background Color change programmatically

Marutharasu P

Marutharasu P

10y
10k
1
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)