Bug in a Scroll of DataGrid - WPF? -
i hope can me this:
i have datagrid 20 rows , every time check checkbox in 1 of columns, label value increasing 100 each time or decreasing if unchecked. so, once i've checked rows value of label 2000. see below:
when reduce height of datagrid vertical scroll appear , when i'm checking checkboxes procedure seem similar can see:
but if scroll vertical bar downwards, other checkboxes appear enabled or checked, idea why? in case i've checked first 6 checkboxes , value of label 600, fine, why other ones appear checked ? thanks..
here code i've used:
<stackpanel name="spuno" width="auto " lostkeyboardfocus="spuno_lostkeyboardfocus" > <button name="btn_accion" margin="5" width="100" height="30" content="accion" click="btn_accion_click"> </button> <label name="lbl_muestra" width="300" margin="5"/> <datagrid name="dg_pruebas" autogeneratecolumns="false" datacontext="{binding}" height="200" width="300" selectionchanged="dg_pruebas_selectionchanged"> <datagrid.columns> <datagridtextcolumn header="id" binding="{binding path=id}"></datagridtextcolumn> <datagridtextcolumn header="nombre" binding="{binding path=nombre}" ></datagridtextcolumn> <!--<datagridcheckboxcolumn header="check" binding="{binding path=ischecked}" ></datagridcheckboxcolumn>--> <datagridtemplatecolumn> <datagridtemplatecolumn.header > <textblock>ver </textblock> </datagridtemplatecolumn.header> <datagridtemplatecolumn.celltemplate> <datatemplate> <checkbox name="ck_prueba" visibility="{binding path=visibility}" checked="ck_prueba_checked" unchecked="ck_prueba_checked" ></checkbox> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> </datagrid.columns> </datagrid> private void ck_prueba_checked(object sender, routedeventargs e) { checkbox check = e.originalsource checkbox; objeto obj = dg_pruebas.selecteditem objeto; if (obj == null) return; if (check.ischecked.value) { lbl_muestra.content = (convert.toint32(lbl_muestra.content)+convert.toint32(obj.valor)).tostring(); } else { lbl_muestra.content = (convert.toint32(lbl_muestra.content) - convert.toint32(obj.valor)).tostring(); } }
it recycling speed
try
virtualizingstackpanel.virtualizationmode="standard"
Comments
Post a Comment