Ive copied the code from the q2 2010 silverlight 4 demo for syncing the filters between the domain data source and the grid.
I also see some code there for loading a collection with distinct values. it seems to me that this a bit of a cheat and the code is consuming the results of a query that is returning the distinct values. am i mistaken or is there some hidden functionality for gathering all the distinct values irregardless of the paging
Private collection As New RadObservableCollection(Of String)()
Private Sub RadGridView1_DistinctValuesLoading(sender As Object, e As Controls.GridView.GridViewDistinctValuesLoadingEventArgs)
collection.Clear()
e.ItemsSource = collection
Dim context As NorthwindDomainContext = DirectCast(DomainDataSource1.DomainContext, NorthwindDomainContext)
context.DistinctValues.Clear()
Dim loadOperation As System.ServiceModel.DomainServices.Client.LoadOperation(Of DistinctValue) = context.Load(context.GetDistinctValuesQuery(e.Column.UniqueName))
AddHandler loadOperation.Completed, AddressOf Me.Completed
End Sub
Private Sub Completed(sender As Object, e As EventArgs)
Dim context As NorthwindDomainContext = DirectCast(DomainDataSource1.DomainContext, NorthwindDomainContext)
Dim values As IEnumerable(Of String) = From i In context.DistinctValues.OfType(Of DistinctValue)() _
Select i.Value
collection.AddRange(values)
End Sub
Private Sub DomainDataSource1_LoadedData(sender As Object, e As System.Windows.Controls.LoadedDataEventArgs)
If e.HasError Then
'Avoid showing exceptions when data exceeds URI length limitations /e.g adding too many filter descriptors/
e.MarkErrorAsHandled()
End If
End Sub
End Class
End Namespace