Problem with a link between Datagrid and Dataform throw a childwindow
hello
i develop visual studio 2010 , silverlight 5.
my poject has ria service connect sql server database.
i want show detail of datagrid row in childwindow.
my problem : childwildow shows textbox without data...
so, xaml of master page :
<usercontrol x:class="lexique.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="300" d:designwidth="400" xmlns:data="clr-namespace:system.windows.controls;assembly=system.windows.controls.data" xmlns:riacontrols="clr-namespace:system.windows.controls;assembly=system.windows.controls.domainservices" xmlns:my="clr-namespace:ria.web;assembly=ria" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"> <grid x:name="layoutroot" background="white" horizontalalignment="stretch" verticalalignment="stretch"> <riacontrols:domaindatasource autoload="true" d:designdata="{d:designinstance my:lx_lexique, createlist=true}" height="0" name="lx_lexiquedomaindatasource" queryname="getlx_lexiquequery" width="0"> <riacontrols:domaindatasource.domaincontext> <my:suiviprojetdomaincontext /> </riacontrols:domaindatasource.domaincontext> </riacontrols:domaindatasource> <data:datapager x:name="onglet" autoellipsis="true" horizontalalignment="stretch" verticalalignment="bottom" displaymode="numeric"></data:datapager> <data:datagrid autogeneratecolumns="false" horizontalalignment="stretch" itemssource="{binding data, elementname=lx_lexiquedomaindatasource}" selecteditem="{binding}" name="lx_lexiquedatagrid" rowdetailsvisibilitymode="visiblewhenselected" verticalalignment="top" isreadonly="true"> <data:datagrid.columns> <data:datagridtextcolumn header="nom" binding="{binding nom}"/> <data:datagridtemplatecolumn> <data:datagridtemplatecolumn.celltemplate> <datatemplate> <button x:name="pbdetail" content="détail" click="pbdetail_click"></button> </datatemplate> </data:datagridtemplatecolumn.celltemplate> </data:datagridtemplatecolumn> </data:datagrid.columns> </data:datagrid> </grid> </usercontrol>
when click on pbdetail :
private sub pbdetail_click(sender system.object, e system.windows.routedeventargs) dim f new childwindow1(lx_lexiquedatagrid.selecteditems) f.show() end sub
this childwindows's xaml , cod-behind:
<controls:childwindow x:class="lexique.childwindow1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:system.windows.controls;assembly=system.windows.controls" width="700" height="800" title="détail" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:dataformkit="clr-namespace:system.windows.controls;assembly=system.windows.controls.data.dataform.toolkit" > <grid x:name="layoutroot" > <grid.rowdefinitions> <rowdefinition height="auto" /> <rowdefinition height="auto" /> </grid.rowdefinitions> <dataformkit:dataform x:name="df" margin="0,12,0,0" commandbuttonsvisibility="none" currentitem="{binding}" grid.row="0" > <dataformkit:dataform.edittemplate> <datatemplate> <stackpanel > <dataformkit:datafield label="nom:" > <textbox height="auto" horizontalalignment="left" name="nomtextbox" text="{binding nom}" margin="3,3,3,3" width="500" textwrapping="wrap" /> </dataformkit:datafield> <dataformkit:datafield label="description:"> <textbox height="auto" acceptsreturn="true" name="descriptiontextbox" text="{binding description, mode=twoway}" verticalalignment="center" verticalscrollbarvisibility="visible" margin="3,3,3,3" width="500" textwrapping="wrap" /> </dataformkit:datafield> <dataformkit:datafield label="description erp:"> <textbox height="auto" acceptsreturn="true" name="descriptionerptextbox" text="{binding descriptionerp, mode=twoway}" verticalalignment="center" verticalscrollbarvisibility="visible" margin="3,3,3,3" width="500" textwrapping="wrap" /> </dataformkit:datafield> </stackpanel> </datatemplate> </dataformkit:dataform.edittemplate> </dataformkit:dataform> <button x:name="okbutton" content="ok" width="75" height="23" horizontalalignment="right" margin="0,12,79,0" grid.row="1" /> </grid> </controls:childwindow>
partial public class childwindow1 inherits childwindow public sub new(dc system.collections.ilist) initializecomponent() df.currentitem = dc end sub private sub okbutton_click(byval sender object, byval e routedeventargs) handles okbutton.click me.dialogresult = true end sub private sub df_currentitemchanged(sender object, e system.eventargs) handles df.currentitemchanged end sub end class
fb
i have seen event "currentitemchanged" of dataform (on childform) fired.
but textbox stay empty without error message...
at debug time :
directcast((new system.collections.generic.mscorlib_collectiondebugview(of object)(directcast(df.currentitem,system.windows.controls.datagridselecteditemscollection).selecteditemscache)).items(0),ria.web.lx_lexique).nom
return right value...
fb
Silverlight > Silverlight 5
Comments
Post a Comment