Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I have a Silverlight Application which displays the companies and their Details.Right now it displays for all the companies.How to add parameter/Filter to the Application so that datagrid can display the details for the selected Company.

Thanks,
Prasant
Posted

1 solution

Hi Prasant,

I'm not sure, if I get you right.

If your question ist about filtering your Company-DataGrid's rows:
You can filter (and sort and group) your data by using a CollectionViewSource as ItemsSource for your DataGrid. Use the Filter event of the CollectionViewSource to check your conditions and the Refresh-Method of the CollectionViewSources View-Property to trigger a new 'apply-filter-to-data'-roundtrip.

If your question is about adding startup-parameters to a silverlight app:
Add a line like the following to your aspx-page containing the SL-object
<param name="initParams" value="pName1=pValue1,pName2=pValue2" />

And in your SL-app's Startup-event add
C#
foreach (var param in e.InitParams)
{
   if (param.Key == "pName1")
   {
      // do something with param.Value...
   }
}

Finally if your questions about synchronizing some master-detail-UI:
If you have a form-like UI for the details, use the DataGrid's SelectedItem as DataContext for the details container (Border, Grid or whatever); if your details-UI is another DataGrid/ItemControl, use the CollectionViewSource from above.

Hope, this hepls. If you need something more specific, provide some code.

Cheers
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900