datagridtemplatecolumn - How to find the Label control in silverlight Datagrid Dropdown SelectionChanged Event -
i using siverlight datagrid in side 1 dropdownlist , label there in dropdown selectedindexchanged event want find label , assign selected value of dropdownlist.
xaml page :
<sdk:datagridtemplatecolumn header="new receipe" canusersort="true" > <sdk:datagridtemplatecolumn.celltemplate> <datatemplate> <grid> <border style="{staticresource gridbackgroundborder}" background="{binding path=isactive, converter={staticresource booltobackgroundvalueconverter1}}"></border> <sdk:label margin="5,0,5,0" x:name="lblcompver" content="{binding path=version}" height="auto" verticalalignment="center" foreground="{binding path=isactive, converter={staticresource booltoforegroundvalueconverter1}}"/> </grid> </datatemplate> </sdk:datagridtemplatecolumn.celltemplate> <sdk:datagridtemplatecolumn.celleditingtemplate> <datatemplate> <grid> <combobox height="auto" selectionchanged="cbocompversel_selectionchanged" x:name="cbocompversel" itemssource="{binding path=compverlist,mode=twoway}" selecteditem="{binding mode=oneway, path=version}" visibility="{binding path=isactive, converter={staticresource booltovisibilityvalueconverter1}}"/> <!--<textbox height="auto" text="{binding mode=twoway, path=version}" x:name="textboxcodever" visibility="{binding path=isactive, converter={staticresource booltovisibilityvalueconverter1}}" acceptsreturn="true"></textbox>--> </grid> </datatemplate> </sdk:datagridtemplatecolumn.celleditingtemplate> </sdk:datagridtemplatecolumn> dropdownlist selectionchanged event :
private sub cbocompversel_selectionchanged(byval sender system.object, byval e system.windows.controls.selectionchangedeventargs) dim src = trycast(sender, combobox) if src isnot nothing dim fe frameworkelement = ctype(src.parent, frameworkelement) dim gridcmbo grid = directcast(fe, grid) dim lblcompver label = ctype(gridcmbo.findname("lblcompver"), label) lblcompver.datacontext = src.selecteditem end if end sub i not able identify lblcompver control assign dropdown selected value
here goes answer
private sub btnassign_click(byval sender system.object, byval e system.windows.routedeventargs) dim btnassign = trycast(sender, button) if btnassign isnot nothing dim columnupdatedby datagridcolumn = taskdatagrid.columns(15) dim columntimestamp datagridcolumn = taskdatagrid.columns(16) dim feupdatedby frameworkelement = columnupdatedby.getcellcontent(taskdatagrid.selecteditem) dim fetimestamp frameworkelement = columntimestamp.getcellcontent(taskdatagrid.selecteditem) dim gridcmboupdatedby grid = directcast(feupdatedby, grid) dim gridcmbotimestamp grid = directcast(fetimestamp, grid) dim lblassignedby label = ctype(gridcmboupdatedby.findname("lblassignedby"), label) dim lblassignedtimestamp label = ctype(gridcmbotimestamp.findname("lblassignedtimestamp"), label) lblassignedby.content = bcomscurrentuser.bcomsuser.username lblassignedtimestamp.content = datetime.now.tostring() end if end sub
Comments
Post a Comment