Freitag, 9. Juli 2010

Silverlight 4: Bye bye ControlParameter

If you've been using Silverlight 4 and some of its ria stuff, you may have noticed that the ControlParameter has gone missing. Actually it has gone for good - and that's a good thing.

ControlParameter was a misfit, why? Look at the following (old) code:
<riaData:ControlParameter ParameterName="title"
                             ControlName="filterTextBox"
                             PropertyName="Text" />

Now there's no databinding, and that most certainly isn't the (new) .NET way. Check out below how it should look now, with Silverlight 4. Here we doe some data filtering with DomainDataSource.FilterDescriptor.

<riaControls:DomainDataSource Name="ExampleSource" QueryName="GetExampleQuery" AutoLoad="True">
<riaControls:DomainDataSource.FilterDescriptors>
<riaControls:FilterDescriptor PropertyPath="title"
Operator="Contains" Value="{Binding Text, ElementName=filterTextBox}">
</riaControls:FilterDescriptor>
</riaControls:DomainDataSource.FilterDescriptors>
<riaControls:DomainDataSource.DomainContext>
<domain:ExampleDataContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>

See, everything is well now. :-)

Keine Kommentare:

Kommentar veröffentlichen

Socialize!