Can i control current row attribute in datagrid?

Apr 15, 2009 at 3:23 PM

Can i control current row attribute in datagrid?

if i wanna set background color to current row, then how can i use this?

in case of .net 2.0 repeater control, there's can set attribute during rowbound evnet.

in that case of WPF datagrid, i was found LoadingRow event,

but i can't select current row during bounding time.

i wanna set attribute during bounding time.

because i'll get generic list from dataset, that is include flag field.

so it's able to set to attribute during bounding time, i can control current row of bounding row. :)

thanks. :)

Apr 15, 2009 at 3:53 PM
i got it... :)

i was solve that compare object type and convert object type.

STDActivityMgmtObject  is my Generic object...


        private void dataGrid1_LoadingRow(object sender, DataGridRowEventArgs e)
            STDActivityMgmtObject myObject = new STDActivityMgmtObject();

            if (e.Row.DataContext.GetType() == myObject.GetType())
                myObject = (STDActivityMgmtObject)e.Row.DataContext;

                if (!myObject.Selected.Equals("Selected"))
                    e.Row.Background = BasePage.myBackGroundBrush;
                    e.Row.Foreground = BasePage.myForeGroundBrush;




but is it right???