Perform actions after WPF DataGrid data is completely bound -


i have old windows forms application @ work converting wpf. part of this, there button which, when clicked, creates brand new datagridview , adds page, binding data sql query. data bever written database, new column added end of data checkbox on it, , when checkbox changed id row passed method along state of checkbox.

in wpf, have dynamic grid creation working, , data binding. having found couldn't directly add column datagrid itself, i've added source dataset table before binding. works , whos data along checkbox each row. however, can't event fire when individual checkbox clicked.

i have managed find code @ http://forums.silverlight.net/t/11547.aspx, causes row commit whenever checkbox changed, code pass id , bool value resides in editending event. updatesourcetrigger added each checkbox looping on each row in checkbox column during "loaded" event of datagrid, failing, , after internet searching seems because "loaded" doesn't guarantee data has finished binding, , i'm finding datagrid.items contains more items there containers in grid @ point event fires. below code i'm trying use bind updatetrigger, @ row 32 containerfromindex method returns null. there 69 items in dgvnew.items @ point.

dgvnew.loaded += new routedeventhandler(delegate(object sender, routedeventargs e)         {             (var = 0; < dgvnew.columns.count; i++)             {                 datagridboundcolumn column = dgvnew.columns[i] datagridboundcolumn;                 if (column != null && column.header.tostring() == "haspermission")                 {                     (var j = 0; j < dgvnew.items.count; j++)                     {                         datagridrow row = (datagridrow)dgvnew.itemcontainergenerator.containerfromindex(j);                         updatesourcetriggerhelper.setupdatesourcetrigger(column.getcellcontent(row), true);                     }                 }             }         }); 

i've tried wrapping loop in event handler itemcontainergenerator.statuschanged , checking status itemsgenerated, didn't either.

can see i'm going wrong, in code or in understanding?


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -