2010-08-18
| Rate This Article: | Add This Article To: |
To read this code tutorial in its entirety, please visit ASPFree.com: Silverlight 4.0: Query Parameters of DomainDataSource - A Second Glance
The content in the second row of the form is filled with the “DataGrid” as shown below:
<sdk:DataGrid Grid.Row="1"
x:Name="dgEmp"
Margin="8" MinHeight="200" IsReadOnly="True"
AutoGenerateColumns="True"
ItemsSource="{Binding Data, ElementName=EmpDomDataSource}" />
The above “DataGrid” fills the entire space in the second row until it reaches the maximum width/height of the form. Furthermore, it is bound to “EmpDomDataSource,” which is defined as follows:
<UserControl.Resources>
<riaControls:DomainDataSource x:Name="EmpDomDataSource"
LoadSize="15"
QueryName="GetEmpsByDeptno"
AutoLoad="True">
<riaControls:DomainDataSource.DomainContext>
<local:EmpMgrDomainSvc></local:EmpMgrDomainSvc>
</riaControls:DomainDataSource.DomainContext>
<riaControls:DomainDataSource.QueryParameters>
<riaControls:Parameter ParameterName="deptno" Value="{Binding ElementName=txtDeptno, Path=Text}"/>
</riaControls:DomainDataSource.QueryParameters>
</riaControls:DomainDataSource>
</UserControl.Resources>
The above markup explains the following:
- We define a DomainDataSource element named “EmpDomDataSource”
- It is bound to “EmpMgrDomainSvc” (nothing but context).
- It pulls data using “GetEmpsByDeptno” (an entity query of the domain service context).
- The query “GetEmpsByDeptno” accepts a parameter named "deptno."
- The parameter value is directly taken from an existing control, "txtDeptno."
|
![]() |
|


