Telerik blogs

It is my pleasure to present you the newest member of the constantly growing family of XAML controls. RadDataServiceDataSource provides seamless integration between an user interface and data coming from a WCF Data Service. The WCF Data Services technology enables the creation and consumption of OData services for the web. If you want to learn more about the relationship between the two, you may read the whitepaper WCF Data Services and OData At-a-Glance.

With this new control, you can retrieve, shape and edit data using declarative XAML syntax only. RadDataServiceDataSource provides extensive code-behind API for more advanced scenarios. The QueryableDataServiceCollectionView<T> class, which is internally used by the control, is made publicly available for use in view models part of an MVVM architecture, where the usage of UI elements is not recommended. IC392644

RadDataServiceDataSource for WPF was built on top of the WCF Data Services Client Library. RadDataServiceDataSource for Silverlight was built on top of the Silverlight version of the client library respectively. The WPF and Silverlight versions of the control have APIs that are 100% identical.

RadDataServiceDataSource uses a DataServiceContext and a DataServiceQuery<T> to communicate with the server. Thanks to the fact that all controls are part of the Telerik family, RadDataServiceDataSource can codelessly integrate with RadGridView, RadDataPager and RadDataFilter and perform paging, filtering and sorting directly on the server. RadDataServiceDataSource can also be used as a standalone data source control since it provides the public API needed for loading, shaping and editing data.

Features

  • Codeless integration with RadGridView, RadDataPager and RadDataFilter. Since all of the controls share the same data engine logic, when data-bound together they are able to detect each other automatically and start exchanging information. Linking RadGridView, RadDataPager and RadDataFilter to a RadDataServiceDataSource is as easy as binding them to its DataView property. All operations such as paging, filtering and sorting will automatically happen on the server without a single line of code.
  • Filtering can easily be performed through the FilterDescriptors collection of the control. This can either be done manually by the developer through editing the collection in code-behind or it can be left to controls such as RadGridView or RadDataFilter which will automatically translate their filtering criteria and apply it to RadDataServiceDataSource without a single line of code.
  • Sorting can easily be performed through the SortDescriptors collection of the control. This can either be done manually by the developer through editing the collection in code-behind or it can be left to RadGridView which will automatically translate its sorting criteria and apply it to RadDataServiceDataSource without a single line of code.
  • Paging can easily be performed through the paging API that the control provides. It can be done manually by the developer through methods from the MoveTo*Page family and properties such as PageIndex and PageSize. Or it can be left entirely to RadDataPager which will automatically page on the server when bound to RadDataServiceDataSource.
  • Editing is as simple as adding, removing or editing entities in the DataView of the control and then calling the SubmitChanges/RejectChanges methods. These operations can also be left to RadGridView which will automatically transfer them to the RadDataServiceDataSource.
  • MVVM support is provided by the public QueryableDataServiceCollectionView<T> class, which is the view that RadDataServiceDataSource internally uses. The RadDataServiceDataSource control is simply a thin-wrapper over this collection view, which performs all of the heavy lifting. This allows you to use it inside your view models without losing any functionality that the control would otherwise provide.

Here are two sample projects to get you started:

The online documentation should be available very shortly.

Here you can find the online Silverlight demos of the control. For a WPF demo, install RadControls for WPF on your machine and run the local demos.

* In case you are using .NET Framework 3.5, you will need the ADO.NET Data Services Update for .NET Framework 3.5 SP1.


About the Author

Rossen Hristov

 is Senior Software Developer in Telerik XAML Team

Comments

Comments are disabled in preview mode.