Vladimir Enchev's blog Vladimir Enchev's blog http://blogs.telerik.com/VladimirEnchev/Posts.aspx http://backend.userland.com/rss New Feature: RadGridView for Silverlight and WPF now can export totals to Excel, ExcelML, Word and CSV <p>I’m happy to inform you that with our <a target="_blank" href="http://www.telerik.com/account/latest-internal-builds.aspx">latest internal build</a> you will be able to export <a target="_blank" href="http://demos.telerik.com/silverlight/#GridView/Totals">the grid totals</a> in all supported formats: <br /> <br /> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-NewFeatureRadGridViewforSilverlightandWP_D4B9-Untitled_2.sflb"><img height="404" width="644" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-NewFeatureRadGridViewforSilverlightandWP_D4B9-Untitled_thumb.sflb" alt="Untitled" title="Untitled" style="border: 0px none ; display: inline;" /></a> <br /> <br /> Check the attached demo application &amp; enjoy! </p> <div class="wlWriterEditableSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:01d9b9ca-156f-4d97-9e70-277fa35879a9" style="margin: 0px; padding: 0px; display: inline; float: none;"> <p> <a target="_blank" href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-NewFeatureRadGridViewforSilverlightandWP_D4B9-SilverlightApplication1.sflb">Download</a></p> </div> http://blogs.telerik.com/VladimirEnchev/Posts/10-01-25/new_feature_radgridview_for_silverlight_and_wpf_now_can_export_totals_to_excel_excelml_word_and_csv.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/10-01-25/new_feature_radgridview_for_silverlight_and_wpf_now_can_export_totals_to_excel_excelml_word_and_csv.aspx 2c321c5f-b7ec-4a0c-86de-55943b2bf418 Mon, 25 Jan 2010 07:15:59 GMT How To: Serialize your DataTable to Silverlight using WCF service <p>Did you know that you can serialize any <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx" target="_blank">DataTable</a> to Silverlight easily from your custom WCF service in very few lines of code? <br /> <br /></p> <pre class="code">[<span style="color: #2b91af">OperationContract</span>] <span style="color: blue">public </span><span style="color: #2b91af">IEnumerable</span>&lt;<span style="color: #2b91af">Dictionary</span>&lt;<span style="color: blue">string</span>, <span style="color: blue">object</span>&gt;&gt; GetData() { <span style="color: blue">var </span>table = YourDataTable; <span style="color: blue">var </span>columns = table.Columns.Cast&lt;<span style="color: #2b91af">DataColumn</span>&gt;(); <span style="color: blue">return </span>table.AsEnumerable().Select(r =&gt; columns.Select(c =&gt; <span style="color: blue">new </span>{ Column = c.ColumnName, Value = r[c] }) .ToDictionary(i =&gt; i.Column, i =&gt; i.Value != <span style="color: #2b91af">DBNull</span>.Value ? i.Value : <span style="color: blue">null</span>)); }</pre> <p>&#160;</p> <p>I’ve made small update for <a href="http://blogs.telerik.com/vladimirenchev/posts/09-04-23/lightweight_datatable_for_your_silverlight_applications.aspx" target="_blank">my lightweight DataTable for Silverlight</a> and now you can create the table directly from <strong>IEnumerable&lt;Dictionary&lt;string, object&gt;&gt;</strong>: <br /> <br /></p> <pre class="code"><span style="color: blue">namespace </span>Telerik.Data { <span style="color: blue">public class </span><span style="color: #2b91af">DataTable </span>: <span style="color: #2b91af">IEnumerable </span>{ <span style="color: blue">public </span>DataTable(<span style="color: #2b91af">IEnumerable</span>&lt;<span style="color: #2b91af">Dictionary</span>&lt;<span style="color: blue">string</span>, <span style="color: blue">object</span>&gt;&gt; source) { <span style="color: blue">...<br /></span> }</pre> <pre class="code"> }</pre> <pre class="code">}</pre> <br />Now you can use all these to serialize any <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx" target="_blank">DataTable</a> with unknown number of columns and types to the Silverlight client and bind desired control: <br /> <br /><strong><u><em>XAML</em></u></strong> <br /> <pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">UserControl </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Class</span><span style="color: blue">=&quot;SilverlightApplication1.MainPage&quot; </span><span style="color: red">xmlns</span><span style="color: blue">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; </span><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">x</span><span style="color: blue">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot; </span><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">d</span><span style="color: blue">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot; </span><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">mc</span><span style="color: blue">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot; </span><span style="color: red">mc</span><span style="color: blue">:</span><span style="color: red">Ignorable</span><span style="color: blue">=&quot;d&quot; </span><span style="color: red">d</span><span style="color: blue">:</span><span style="color: red">DesignWidth</span><span style="color: blue">=&quot;640&quot; </span><span style="color: red">d</span><span style="color: blue">:</span><span style="color: red">DesignHeight</span><span style="color: blue">=&quot;480&quot; </span><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">telerik</span><span style="color: blue">=&quot;clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView&quot;&gt; &lt;</span><span style="color: #a31515">Grid </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;LayoutRoot&quot;&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;RadGridView1&quot; /&gt; &lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">UserControl</span><span style="color: blue">&gt; </span></pre> <a href="http://11011.net/software/vspaste"></a> <p> <br /> <br /><strong><u><em>C#</em></u></strong></p> <pre class="code"><span style="color: blue">using </span>System.Windows.Controls; <span style="color: blue">using </span>SilverlightApplication1.ServiceReference1; <span style="color: blue">using </span>Telerik.Data; <span style="color: blue">namespace </span>SilverlightApplication1 { <span style="color: blue">public partial class </span><span style="color: #2b91af">MainPage </span>: <span style="color: #2b91af">UserControl </span>{ <span style="color: blue">public </span>MainPage() { InitializeComponent(); <span style="color: blue">var </span>client = <span style="color: blue">new </span><span style="color: #2b91af">MyServiceClient</span>(); client.GetDataCompleted += (s,e) =&gt; { RadGridView1.ItemsSource = <span style="color: blue">new </span><span style="color: #2b91af">DataTable</span>(e.Result); }; client.GetDataAsync(<span style="color: #a31515">&quot;SELECT CustomerID, CompanyName, ContactName, City, Country, Address, Fax FROM Customers&quot;</span>); } } }</pre> <a href="http://11011.net/software/vspaste"></a> <p> <br />The result - fully functional dynamic DataGrid and DataTable: <br />&#160;<a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToSerializeyourDataTabletoSilverlight_CF69-image_4.sflb"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToSerializeyourDataTabletoSilverlight_CF69-image_thumb_1.sflb" width="645" height="406" /></a> <br /> <br />Enjoy!</p> <p>&#160;</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:7694d224-b68f-4594-b823-ebcb7319e852" class="wlWriterEditableSmartContent"><p> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToSerializeyourDataTabletoSilverlight_CF69-SilverlightApplication1.sflb" target="_blank">Download</a></p></div> http://blogs.telerik.com/VladimirEnchev/Posts/10-01-22/how_to_serialize_your_datatable_to_silverlight_using_wcf_service.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/10-01-22/how_to_serialize_your_datatable_to_silverlight_using_wcf_service.aspx fd980559-b419-4fcd-9ab4-559a3b9b1d8f Fri, 22 Jan 2010 07:01:10 GMT How To: Print your DataGrid (or any UIElement) on multiple pages with Silverlight 4 <p>In Silverlight 4 you can use <a href="http://msdn.microsoft.com/en-us/library/system.windows.printing.printdocument(VS.96).aspx" target="_blank">PrintDocument</a> to print easily any UIElement: <br /> …</p> <p>&nbsp;&nbsp; <span style="color: #0000ff;">var</span> doc = new <span style="color: #408080;">PrintDocument</span>(); <br /> &nbsp;&nbsp; doc.DocumentName = YourDocumentName; </p> <p>&nbsp;&nbsp; doc.PrintPage += (s, e) =&gt; <br /> &nbsp;&nbsp; { <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.PageVisual = YouUIElement; <br /> &nbsp;&nbsp; }; <br /> &nbsp;&nbsp; doc.Print(); <br /> … <br /> <br /> and I’ve made an extension method that can be used to print any UIElement on multiple pages: </p> <p><span style="color: #0000ff;">public static void</span> Print(<span style="color: #0000ff;">this</span> <span style="color: #408080;">UIElement</span> source, <span style="color: #0000ff;">string</span> documentName) <br /> { <br /> &nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">var</span> doc = new <span style="color: #408080;">PrintDocument</span>(); <br /> &nbsp;&nbsp;&nbsp; doc.DocumentName = documentName; </p> <p>&nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">var</span> offsetY = <span style="color: #800040;">0d</span>; <br /> &nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">var</span> totalHeight = <span style="color: #800040;">0d</span>; </p> <p>&nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">var</span> canvas = <span style="color: #0000ff;">new</span> <span style="color: #408080;">Canvas</span>(); <br /> &nbsp;&nbsp;&nbsp; canvas.Children.Add(source); </p> <p>&nbsp;&nbsp;&nbsp; doc.PrintPage += (s, e) =&gt; <br /> &nbsp;&nbsp;&nbsp; { <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.PageVisual = canvas; </p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">if</span> (totalHeight == <span style="color: #800040;">0</span>) <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; totalHeight = source.DesiredSize.Height; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #408080;">Canvas</span>.SetTop(source, -offsetY); </p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; offsetY += e.PrintableArea.Height; <br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.HasMorePages = offsetY &lt;= totalHeight; <br /> &nbsp;&nbsp;&nbsp; }; <br /> <br /> &nbsp;&nbsp;&nbsp; doc.Print(); <br /> } </p> <p></p> <p>You can download the attached application (Visual Studio 2010) to check how easily you can print <a href="http://demos.telerik.com/silverlight/#GridView/FirstLook" target="_blank">RadGridView for Silverlight</a> on multiple pages. <br /> <br /> Enjoy!</p> <div style="margin: 0px; padding: 0px; display: inline; float: none;" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:579c5e31-bef0-4b63-b45a-d45355fe2908" class="wlWriterEditableSmartContent"> <p> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToPrintyourSilverlightUIElementonmult_E4C4-SilverlightApplication1.sflb" target="_blank">Download</a></p> </div> http://blogs.telerik.com/VladimirEnchev/Posts/10-01-15/how_to_print_your_datagrid_or_any_uielement_on_multiple_pages_with_silverlight_4.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/10-01-15/how_to_print_your_datagrid_or_any_uielement_on_multiple_pages_with_silverlight_4.aspx 69f0db69-ef19-4fe3-b3f4-cf47700d2b21 Fri, 15 Jan 2010 08:44:25 GMT How To: Server sorting, filtering, grouping and paging with RadGridView for Silverlight without WCF RIA services <p>With our upcoming service pack (Q3 SP2) of <a target="_blank" href="http://www.telerik.com/products/silverlight/gridview.aspx">RadGridView for Silverlight</a> all operation like sorting, grouping and paging on the server can be achieved completely codeless <a target="_blank" href="http://demos.telerik.com/silverlight/#GridView/DomainDataSource">when the grid is bound to DomainDataSource</a> and <a target="_blank" href="http://blogs.telerik.com/vladimirenchev/posts/10-01-07/how_to_populate_radgridview_for_silverlight_distinct_filters_asynchronously_using_wcf_ria_services.aspx">in my previous post I’ve showed how to do the same for filtering</a> with minimum code. You can even <a target="_blank" href="http://blogs.telerik.com/vladimirenchev/posts/09-12-21/how_to_custom_scrolling_with_radgridview_for_silverlight_and_wcf_ria_services.aspx">force the grid vertical scrollbar to page on the server</a> instead <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.windows.controls.datapager(VS.95).aspx">DataPager</a>. <br /> <br /> Since <a target="_blank" href="http://silverlight.net/getstarted/riaservices/">WCF RIA services</a> is still in beta I’ve made small example how to achieve sorting, grouping, paging and filtering using custom web service: <br /> <br /> XAML</p> <pre class="code"><span style="color: blue;">&lt;</span><span style="color: #a31515;">UserControl </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Class</span><span style="color: blue;">="SilverlightApplication1.MainPage"<br /> </span><span style="color: red;">xmlns</span><span style="color: blue;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <br /> </span><span style="color: red;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">x</span><span style="color: blue;">="http://schemas.microsoft.com/winfx/2006/xaml"<br /> </span><span style="color: red;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">d</span><span style="color: blue;">="http://schemas.microsoft.com/expression/blend/2008" </span><span style="color: red;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">mc</span><span style="color: blue;">="http://schemas.openxmlformats.org/markup-compatibility/2006" <br /> </span><span style="color: red;">mc</span><span style="color: blue;">:</span><span style="color: red;">Ignorable</span><span style="color: blue;">="d" </span><span style="color: red;">d</span><span style="color: blue;">:</span><span style="color: red;">DesignWidth</span><span style="color: blue;">="640" </span><span style="color: red;">d</span><span style="color: blue;">:</span><span style="color: red;">DesignHeight</span><span style="color: blue;">="480"<br /> </span><span style="color: red;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">data</span><span style="color: blue;">="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"<br /> </span><span style="color: red;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">telerik</span><span style="color: blue;">="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"&gt;<br /> &lt;</span><span style="color: #a31515;">Grid </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="LayoutRoot"</span><span style="color: blue;">&gt;<br /> &lt;</span><span style="color: #a31515;">Grid.RowDefinitions</span><span style="color: blue;">&gt;<br /> &lt;</span><span style="color: #a31515;">RowDefinition </span><span style="color: blue;">/&gt;<br /> &lt;</span><span style="color: #a31515;">RowDefinition </span><span style="color: red;">Height</span><span style="color: blue;">="Auto" /&gt;<br /> &lt;/</span><span style="color: #a31515;">Grid.RowDefinitions</span><span style="color: blue;">&gt;<br /> &lt;</span><span style="color: #a31515;">telerik</span><span style="color: blue;">:</span><span style="color: #a31515;">RadGridView </span><span style="color: red;">AutoExpandGroups</span><span style="color: blue;">="True" </span><span style="color: red;">ItemsSource</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Data</span><span style="color: blue;">}"<br /> </span><span style="color: red;">DistinctValuesLoading</span><span style="color: blue;">="RadGridView1_DistinctValuesLoading" /&gt;<br /> &lt;</span><span style="color: #a31515;">data</span><span style="color: blue;">:</span><span style="color: #a31515;">DataPager </span><span style="color: red;">Source</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Data</span><span style="color: blue;">}" </span><span style="color: red;">Grid.Row</span><span style="color: blue;">="1" /&gt;<br /> &lt;/</span><span style="color: #a31515;">Grid</span><span style="color: blue;">&gt;<br />&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: blue;">&gt;</span></pre> <a href="http://11011.net/software/vspaste"></a> <p> <br /> C#</p> <pre class="code"><span style="color: blue;">using </span>System.Windows.Controls; <span style="color: blue;">using </span>Telerik.Windows.Controls.GridView; <span style="color: blue;">using </span>Telerik.Windows.Data; <span style="color: blue;">namespace </span>SilverlightApplication1 { <span style="color: blue;">public partial class </span><span style="color: #2b91af;">MainPage </span>: <span style="color: #2b91af;">UserControl<br /> </span>{ <span style="color: blue;">public </span>MainPage() { InitializeComponent(); DataContext = <span style="color: blue;">new </span><span style="color: #2b91af;">MyDataContext</span>(); } <span style="color: blue;">void </span>RadGridView1_DistinctValuesLoading(<span style="color: blue;">object </span>sender, <span style="color: #2b91af;">GridViewDistinctValuesLoadingEventArgs </span>e) { <span style="color: blue;">var </span>client = ((<span style="color: #2b91af;">MyDataContext</span>)DataContext).Client; <span style="color: blue;">var </span>collection = <span style="color: blue;">new </span><span style="color: #2b91af;">RadObservableCollection</span>&lt;<span style="color: blue;">object</span>&gt;(); e.ItemsSource = collection; client.GetDistinctValuesCompleted += (s, args) =&gt; { collection.Clear(); collection.AddRange(args.Result); }; client.GetDistinctValuesAsync(e.Column.UniqueName); } } }</pre> <a href="http://11011.net/software/vspaste"></a> <p> <br /> The result: <br /> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToServersidesortingfilteringgroupinga_8878-image_2.sflb"><img height="609" width="829" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToServersidesortingfilteringgroupinga_8878-image_thumb.sflb" alt="image" title="image" style="border-style: solid; border-width: 0px; display: inline;" /></a>&nbsp; <br /> <br /> The grid expressions are transferred as strings (I’ve made several extension methods available in DescriptorsExtensions.cs) and on the server-side these string expressions are used in a custom <a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb547113.aspx">LinqDataSource</a> in order to handle all operations on the data-base server. <br /> <br /> You can check also MyDataContext.cs to know more about how to create your own <a target="_blank" href="http://www.telerik.com/help/silverlight/telerik.windows.data-telerik.windows.data.queryablecollectionview.html">QueryableCollectionView</a> to handle such advanced custom scenario where you need to handle paging, grouping, sorting and filtering by yourself. <br /> <br /> Enjoy! <br /> </p> <div class="wlWriterEditableSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:e5d37f74-b1d1-4038-9e2c-54c846894b4f" style="margin: 0px; padding: 0px; display: inline; float: none;"> <p> <a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/Server_sorting_filtering_grouping_and_paging_with_RadGridView_for_Silverlight_without_WCF_RIA_services.sflb?download=true">Download</a></p> </div> http://blogs.telerik.com/VladimirEnchev/Posts/10-01-14/how_to_server_sorting_filtering_grouping_and_paging_with_radgridview_for_silverlight_without_wcf_ria_services.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/10-01-14/how_to_server_sorting_filtering_grouping_and_paging_with_radgridview_for_silverlight_without_wcf_ria_services.aspx 3eabcc0c-a597-4c4c-93a2-45e4272f9b27 Thu, 14 Jan 2010 08:13:34 GMT How To: Populate RadGridView for Silverlight distinct filters asynchronously using WCF RIA Services <p>With our upcoming service pack (Q3 2009 SP2) you will be able to populate distinct values asynchronously using the DistinctValuesLoading event. To achieve this you can assign any <a href="http://msdn.microsoft.com/en-us/library/system.collections.specialized.inotifycollectionchanged.collectionchanged%28VS.95%29.aspx" target="_blank">INotifyCollectionChanged</a> collection for distinct values ItemsSource and RadGridView will update the UI immediately on any change. <br /> <br />I’ve made small demo on how to achieve this using <a href="http://silverlight.net/getstarted/riaservices/" target="_blank">WCF RIA Services</a> and <a href="http://demos.telerik.com/silverlight/#GridView/DomainDataSource" target="_blank">RadGridView bound to DomainDataSource with DataPager</a> – in this case the grid distinct values are populated from the entire collection server-side not only from the current downloaded page: <br />&#160;<a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToPopulateRadGridViewforSilverlightdi_9D9E-image_8.sflb"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToPopulateRadGridViewforSilverlightdi_9D9E-image_thumb_3.sflb" width="660" height="442" /></a> <br /> <br /><strong><u>server-side</u></strong>:</p> <pre class="code"><span style="color: blue">public </span><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">DistinctValue</span>&gt; GetDistinctValues(<span style="color: blue">string </span>propertyName) { <span style="color: blue">var </span>list = <span style="color: blue">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">DistinctValue</span>&gt;(); <span style="color: blue">var </span>values = <span style="color: blue">this</span>.DataContext.Customers.Select(propertyName).OfType&lt;<span style="color: blue">string</span>&gt;().Distinct().ToList(); <span style="color: blue">for </span>(<span style="color: blue">var </span>i = 0; i &lt; values.Count; i++) { list.Add(<span style="color: blue">new </span><span style="color: #2b91af">DistinctValue</span>() { ID = i, Value = values[i] }); } <span style="color: blue">return </span>list; }<br />...</pre> <pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">DistinctValue </span>{ [<span style="color: #2b91af">Key</span>] <span style="color: blue">public int </span>ID { <span style="color: blue">get</span>; <span style="color: blue">set</span>; } <span style="color: blue">public string </span>Value { <span style="color: blue">get</span>; <span style="color: blue">set</span>; } }</pre> <a href="http://11011.net/software/vspaste"></a> <pre class="code">...<br /></pre> <a href="http://11011.net/software/vspaste"></a> <p><strong><u>client-side</u></strong>:</p> <pre class="code"><span style="color: blue">private void </span>RadGridView1_DistinctValuesLoading(<span style="color: blue">object </span>sender, Telerik.Windows.Controls.GridView.<span style="color: #2b91af">GridViewDistinctValuesLoadingEventArgs </span>e) { <span style="color: blue">var </span>collection = <span style="color: blue">new </span><span style="color: #2b91af">RadObservableCollection</span>&lt;<span style="color: blue">string</span>&gt;(); e.ItemsSource = collection; <span style="color: blue">var </span>context = (<span style="color: #2b91af">NorthwindDomainContext</span>)DomainDataSource1.DomainContext; context.DistinctValues.Clear(); context.Load(context.GetDistinctValuesQuery(e.Column.UniqueName)).Completed += (s, args) =&gt; { collection.AddRange(context.DistinctValues.OfType&lt;<span style="color: #2b91af">DistinctValue</span>&gt;().Select(dv =&gt; dv.Value)); }; }</pre> <a href="http://11011.net/software/vspaste"></a> <p> <br /></p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:99bd0d9c-3c7d-488f-a608-de695e208c27" class="wlWriterEditableSmartContent"><p> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToPopulateRadGridViewforSilverlightdi_9D9E-SilverlightApplication1.sflb" target="_blank">Download</a></p></div> http://blogs.telerik.com/VladimirEnchev/Posts/10-01-07/how_to_populate_radgridview_for_silverlight_distinct_filters_asynchronously_using_wcf_ria_services.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/10-01-07/how_to_populate_radgridview_for_silverlight_distinct_filters_asynchronously_using_wcf_ria_services.aspx 9f269b22-6058-46c7-8641-a4d49f1cd2ec Thu, 07 Jan 2010 03:30:26 GMT How To: Easy print and print preview with RadGridView for WPF <p>Using <a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.fixeddocument.aspx" target="_blank">FixedDocument</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.documentviewer.aspx" target="_blank">DocumentViewer</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.printdialog.aspx" target="_blank">PrintDialog</a> you can easily create your own print and/or print preview for <a href="http://demos.telerik.com/wpf/?GridView/FirstLook" target="_blank">RadGridView for WPF</a>. <br /></p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToEasyprintandprintpreviewwithRadGrid_ED67-Untitled_2.sflb"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Untitled" border="0" alt="Untitled" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToEasyprintandprintpreviewwithRadGrid_ED67-Untitled_thumb.sflb" width="644" height="445" /></a> <br /> <br />I’ve made two extension methods Print() and PrintPreview() to illustrate how to turn the grid into a print friendly document in few lines of code: <br />… <br /></p> <pre class="code"><span style="color: blue">public static void </span>PrintPreview(<span style="color: blue">this </span><span style="color: #2b91af">GridViewDataControl </span>source) { <span style="color: blue">var </span>window = <span style="color: blue">new </span><span style="color: #2b91af">Window</span>() { Title = <span style="color: #a31515">&quot;Print Preview&quot;</span>, Content = <span style="color: blue">new </span><span style="color: #2b91af">DocumentViewer</span>() { Document = ToFixedDocument(ToPrintFriendlyGrid(source), <span style="color: blue">new </span><span style="color: #2b91af">PrintDialog</span>()) } }; window.ShowDialog(); } <span style="color: blue">public static void </span>Print(<span style="color: blue">this </span><span style="color: #2b91af">GridViewDataControl </span>source, <span style="color: blue">bool </span>showDialog) { <span style="color: blue">var </span>dialog = <span style="color: blue">new </span><span style="color: #2b91af">PrintDialog</span>(); <span style="color: blue">var </span>dialogResult = showDialog ? dialog.ShowDialog() : <span style="color: blue">true</span>; <span style="color: blue">if </span>(dialogResult == <span style="color: blue">true</span>) { <span style="color: blue">var </span>viewer = <span style="color: blue">new </span><span style="color: #2b91af">DocumentViewer</span>(); viewer.Document = ToFixedDocument(ToPrintFriendlyGrid(source), dialog); dialog.PrintDocument(viewer.Document.DocumentPaginator, <span style="color: #a31515">&quot;&quot;</span>); } }<br />…<br /></pre> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:600a5389-0b56-4564-b6ea-5979314821ff" class="wlWriterEditableSmartContent"><p> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToEasyprintandprintpreviewwithRadGrid_ED67-WpfApplication1.sflb" target="_blank">Download</a></p></div> <pre class="code"><br /><br /><br /></pre> http://blogs.telerik.com/VladimirEnchev/Posts/09-12-28/how_to_easy_print_and_print_preview_with_radgridview_for_wpf.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-12-28/how_to_easy_print_and_print_preview_with_radgridview_for_wpf.aspx 3fe5f57a-6cb5-4d42-9866-57d682ad6345 Mon, 28 Dec 2009 09:02:44 GMT How To: Custom scrolling with RadGridView for Silverlight and WCF RIA Services <p>I’m pleased to announce that with our upcoming service pack (Q3 SP2 – middle of January 2010) you will be able to plug your own scrolling logic for <a href="http://demos.telerik.com/silverlight/#GridView/FirstLook">RadGridView for Silverlight</a>. I’ve made small demo on how to page DomainDataSource using the grid vertical scrollbar with minimal coding effort:<br /> <br /> &nbsp; <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToCustomscrollingwithRadGridViewforSi_C288-image_8.sflb"><img height="371" width="541" style="border-style: solid; border-width: 0px; display: inline;" title="image" alt="image" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToCustomscrollingwithRadGridViewforSi_C288-image_thumb_3.sflb" /></a> </p> <blockquote> <p>…</p> <pre class="code"><span style="color: blue;">&lt;</span><span style="color: #a31515;">riaControls</span><span style="color: blue;">:</span><span style="color: #a31515;">DomainDataSource </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="DomainDataSource1" </span><span style="color: red;">QueryName</span><span style="color: blue;">="GetOrder_Details"&gt;<br /> &lt;</span><span style="color: #a31515;">riaControls</span><span style="color: blue;">:</span><span style="color: #a31515;">DomainDataSource.DomainContext</span><span style="color: blue;">&gt;<br /> &lt;</span><span style="color: #a31515;">web</span><span style="color: blue;">:</span><span style="color: #a31515;">NorthwindDomainContext </span><span style="color: blue;">/&gt;<br /> &lt;/</span><span style="color: #a31515;">riaControls</span><span style="color: blue;">:</span><span style="color: #a31515;">DomainDataSource.DomainContext</span><span style="color: blue;">&gt;<br />&lt;/</span><span style="color: #a31515;">riaControls</span><span style="color: blue;">:</span><span style="color: #a31515;">DomainDataSource</span><span style="color: blue;">&gt;<br />&lt;</span><span style="color: #a31515;">telerikGridView</span><span style="color: blue;">:</span><span style="color: #a31515;">RadGridView <span style="color: red;">telerik</span><span style="color: blue;">:</span><span style="color: red;">Theming.Theme</span><span style="color: blue;">="Summer" </span><br /> </span><strong><span style="color: red;">scrolling</span><span style="color: blue;">:</span><span style="color: red;">CustomScrolling.DomainDataSource</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">ElementName</span></strong><span style="color: blue;"><strong>=DomainDataSource1}"<br /> </strong></span><span style="color: red;">ItemsSource</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Data</span><span style="color: blue;">, </span><span style="color: red;">ElementName</span><span style="color: blue;">=DomainDataSource1}" <br /> </span><span style="color: red;">IsBusy</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">IsLoadingData</span><span style="color: blue;">, </span><span style="color: red;">ElementName</span><span style="color: blue;">=DomainDataSource1}" /&gt;<br /></span></pre> <a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a> <pre class="code"></pre> <p><a href="http://11011.net/software/vspaste"></a>…</p> </blockquote> <p></p> <div style="margin: 0px; padding: 0px; display: inline; float: none;" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:39e37859-2747-4f59-b418-bb406e35e584" class="wlWriterEditableSmartContent"> <p> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToCustomscrollingwithRadGridViewforSi_C288-SilverlightApplication1_1.sflb" target="_blank">Download</a></p> </div> http://blogs.telerik.com/VladimirEnchev/Posts/09-12-21/how_to_custom_scrolling_with_radgridview_for_silverlight_and_wcf_ria_services.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-12-21/how_to_custom_scrolling_with_radgridview_for_silverlight_and_wcf_ria_services.aspx b530c63c-3ad9-4a21-a33d-ec1c2a14d20e Mon, 21 Dec 2009 06:05:07 GMT New Feature: Silverlight RIA services compression with Telerik RadControls Q3 2009 <p>With our upcoming Q3 2009 release you can use RadCompression (part of Telerik.Web.UI.dll) to compress your RIA services:</p> <p>Without compression:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-SilverlightRIAservicescompressionwithTel_CEF0-Before_2.sflb"><img title="Before" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="285" alt="Before" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-SilverlightRIAservicescompressionwithTel_CEF0-Before_thumb.sflb" width="572" border="0" /></a> <br /> <br />With compression:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-SilverlightRIAservicescompressionwithTel_CEF0-After_2.sflb"><img title="After" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="309" alt="After" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-SilverlightRIAservicescompressionwithTel_CEF0-After_thumb.sflb" width="568" border="0" /></a> </p> <p>Check the numbers :)</p> <p>Enjoy!</p> <p>[<a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/SilverlightRIAServicesCompression.sflb?download=true" target="_blank">Download</a>]</p> http://blogs.telerik.com/VladimirEnchev/Posts/09-10-23/new_feature_silverlight_ria_services_compression_with_telerik_radcontrols_q3_2009.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-10-23/new_feature_silverlight_ria_services_compression_with_telerik_radcontrols_q3_2009.aspx 0fb0d178-a257-4851-966a-03ee7a729c39 Fri, 23 Oct 2009 06:48:27 GMT How To: Silverlight grid hierarchy load on demand using MVVM and RIA services <p>I’ve made small example on how to load on demand RadGridView hierarchy child data using MVVM and RIA service:&#160; <br /> <br />&#160;&#160; <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToSilverlightgridhierarchyloadondeman_CFA1-Untitled_10.sflb"><img title="Untitled" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="376" alt="Untitled" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToSilverlightgridhierarchyloadondeman_CFA1-Untitled_thumb_4.sflb" width="673" border="0" /></a> </p> <p></p> <p>Using partial classes you can extend very easily generated code with desired load on demand logic:</p> <pre class="code"><span style="color: blue"> public partial class </span><span style="color: #2b91af">Customer </span>{ <span style="color: blue">bool </span>ordersLoaded = <span style="color: blue">false</span>; <span style="color: blue">public </span><span style="color: #2b91af">IEnumerable</span>&lt;<span style="color: #2b91af">Order</span>&gt; CustomerOrders { <span style="color: blue">get </span>{ <span style="color: blue">if </span>(!ordersLoaded) { <span style="color: blue">var </span>query = <span style="color: blue">from </span>o <span style="color: blue">in </span><span style="color: #2b91af">MyDataContext</span>.DomainContext.GetOrdersQuery() <span style="color: blue">where </span>o.CustomerID == CustomerID <span style="color: blue">select </span>o;</pre> <pre class="code"> <span style="color: #2b91af">MyDataContext</span>.DomainContext.Load(query); ordersLoaded = <span style="color: blue">true</span>; } <span style="color: blue">return </span>Orders; } } }<br /></pre> <p><a href="http://11011.net/software/vspaste"></a>and if you create your own data context you can bind all these completely codeless:</p> <pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView </span><span style="color: red">Name</span><span style="color: blue">=&quot;RadGridView1&quot; </span><span style="color: red">IsReadOnly</span><span style="color: blue">=&quot;True&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Customers</span><span style="color: blue">}&quot;&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.ChildTableDefinitions</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewTableDefinition </span><span style="color: blue">/&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.ChildTableDefinitions</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.Columns</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Customer ID&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">CustomerID</span><span style="color: blue">}&quot; /&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Company Name&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">CompanyName</span><span style="color: blue">}&quot; /&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Contact Name&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">ContactName</span><span style="color: blue">}&quot; /&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;City&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">City</span><span style="color: blue">}&quot; /&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Country&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Country</span><span style="color: blue">}&quot; /&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.Columns</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.HierarchyChildTemplate</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">DataTemplate</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView </span><span style="color: red">IsReadOnly</span><span style="color: blue">=&quot;True&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">CustomerOrders</span><span style="color: blue">}&quot;&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.ChildTableDefinitions</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewTableDefinition </span><span style="color: blue">/&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.ChildTableDefinitions</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.Columns</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Order ID&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">OrderID</span><span style="color: blue">}&quot; /&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Order Date&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">OrderDate</span><span style="color: blue">}&quot; /&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.Columns</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.HierarchyChildTemplate</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">DataTemplate</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView </span><span style="color: red">IsReadOnly</span><span style="color: blue">=&quot;True&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Details</span><span style="color: blue">}&quot;&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.Columns</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Unit Price&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">UnitPrice</span><span style="color: blue">}&quot; /&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Quantity&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Quantity</span><span style="color: blue">}&quot; /&gt; &lt;</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">GridViewDataColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Discount&quot; </span><span style="color: red">DataMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Discount</span><span style="color: blue">}&quot; /&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.Columns</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">DataTemplate</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.HierarchyChildTemplate</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">DataTemplate</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView.HierarchyChildTemplate</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">telerik</span><span style="color: blue">:</span><span style="color: #a31515">RadGridView</span><span style="color: blue">&gt;</span></pre> <br />Enjoy!<a href="http://11011.net/software/vspaste"></a> <p>[<a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/SilverlightGridHierarchyUsingMVVMAndServices.sflb?download=true" target="_blank">Download</a>]</p> http://blogs.telerik.com/VladimirEnchev/Posts/09-10-16/how_to_silverlight_grid_hierarchy_load_on_demand_using_mvvm_and_ria_services.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-10-16/how_to_silverlight_grid_hierarchy_load_on_demand_using_mvvm_and_ria_services.aspx f9c1942f-47cd-48d1-844c-e9f4037baa75 Fri, 16 Oct 2009 06:57:39 GMT How To: Easy printing with Telerik RadGridView for Silverlight <p>Using <a href="http://demos.telerik.com/silverlight/#GridView/Exporting" target="_blank">export to HTML feature</a> you can print the grid very easily just by adding following JavaScript to the export output:</p> <pre class="code"><span style="color: #a31515">&lt;script type=&quot;&quot;text/javascript&quot;&quot;&gt;print();&lt;/script&gt;</span></pre> <a href="http://11011.net/software/vspaste"></a> <p> <br />You can use WebClient to save the output as file on the server:</p> <p><u>Silverlight client side</u>:</p> <pre class="code"><span style="color: #2b91af">Uri </span>uri = <span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(<span style="color: #2b91af">HtmlPage</span>.Document.DocumentUri, <span style="color: #2b91af">String</span>.Format(<span style="color: #a31515">&quot;PrintHandler.aspx?FileName={0}&quot;</span>, fileName)); <span style="color: #2b91af">WebClient </span>client = <span style="color: blue">new </span><span style="color: #2b91af">WebClient</span>(); client.UploadStringCompleted += <span style="color: blue">new </span><span style="color: #2b91af">UploadStringCompletedEventHandler</span>(client_UploadStringCompleted); client.UploadStringAsync(uri, <span style="color: #2b91af">String</span>.Format(<span style="color: #a31515">&quot;{0}{1}&quot;</span>, <strong>RadGridView1.ToHtml()</strong>, printScript));</pre> <pre class="code"><u>ASP.NET server side</u>:</pre> <pre class="code"><span style="color: blue">protected void </span>Page_Load(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e) { <span style="color: blue">if </span>(Request.QueryString[<span style="color: #a31515">&quot;FileName&quot;</span>] != <span style="color: blue">null</span>) { <span style="color: #2b91af">File</span>.WriteAllText(Server.MapPath(Request.QueryString[<span style="color: #a31515">&quot;FileName&quot;</span>]), <span style="color: blue">new </span><span style="color: #2b91af">StreamReader</span>(Request.InputStream).ReadToEnd(), <span style="color: #2b91af">Encoding</span>.UTF8); } }<br /></pre> <a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a> <p>and request this file when upload is finished:</p> <pre class="code"><span style="color: blue">void </span>client_UploadStringCompleted(<span style="color: blue">object </span>sender, <span style="color: #2b91af">UploadStringCompletedEventArgs </span>e) { <span style="color: #2b91af">HtmlPage</span>.Window.Navigate(<span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(<span style="color: #2b91af">HtmlPage</span>.Document.DocumentUri, fileName), <span style="color: #a31515">&quot;_blank&quot;</span>, <span style="color: #a31515">&quot;menubar=0;toolbar=0;fullscreen=1;&quot;</span>); }</pre> <p><a href="http://11011.net/software/vspaste"></a> <br />… and that’s it! :) <br /> <br /></p> <p>The result: <br />- RadGridView bound to RIA service completely codeless using DomainDataSource: <br /><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToEasyprintingwithTelerikRadGridViewf_82BE-Untitled_2.sflb"><img title="Untitled" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="320" alt="Untitled" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToEasyprintingwithTelerikRadGridViewf_82BE-Untitled_thumb.sflb" width="595" border="0" /></a> <br /> <br />- Print preview with immediate print dialog:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToEasyprintingwithTelerikRadGridViewf_82BE-Untitled1_4.sflb"><img title="Untitled1" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="474" alt="Untitled1" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-HowToEasyprintingwithTelerikRadGridViewf_82BE-Untitled1_thumb_1.sflb" width="628" border="0" /></a> </p> <p></p> <p></p> <p> <br />If you have “<a href="http://msdn.microsoft.com/en-us/library/dd183313(VS.85).aspx" target="_blank">Microsoft XPS Document Writer</a>” you can save the grid output as XPS and using “<a href="http://office.microsoft.com/en-us/help/HP010771031033.aspx" target="_blank">Microsoft Office Document Image Writer</a>” you can save the output as pageable TIFF! <br /> <br />There are many free PDF printers also and if you have some of them (I’m using <a href="http://www.bullzip.com/products/pdf/info.php#download" target="_blank">this one</a>) you can get the grid output immediately in PDF! <br /> <br />Enjoy!</p> <p>[<a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/SilverlightGridPrinting.sflb?download=true" target="_blank">Source Code</a>] | [<a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/PDF.sflb?download=true" target="_blank">PDF Output</a>] | [<a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/XPS.sflb?download=true" target="_blank">XPS Output</a>] | [<a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/TIFF.sflb?download=true" target="_blank">TIFF Output</a>] </p> http://blogs.telerik.com/VladimirEnchev/Posts/09-07-29/how_to_easy_printing_with_telerik_radgridview_for_silverlight.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-07-29/how_to_easy_printing_with_telerik_radgridview_for_silverlight.aspx 5413615b-e89d-4493-bf53-84cfb21e1381 Wed, 29 Jul 2009 01:48:34 GMT Today is the day - see the light? SIlverlight 3 is finally out! <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-TodayisthedayseethelightSIlverlight3isfi_DDDB-image_8.sflb"><img src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-TodayisthedayseethelightSIlverlight3isfi_DDDB-image_thumb_3.sflb" alt="image" style="border: 0px solid ; margin: 5px; display: inline; float: left;" title="image" /></a> </p> <p>In fact you can download almost everything even <a href="http://silverlight.net/GetStarted/">now</a>! <br /> <br /> Despite all breaking changes between the beta and RTW (System.Windows.Controls.Data =&gt; System.ComponentModel = &gt; System.Windows.Data) as always Telerik will follow the good traditions and next week we will release RadControls for Silverlight 3. <br /> <br /> Stay tuned – more will come!</p> http://blogs.telerik.com/VladimirEnchev/Posts/09-07-10/today_is_the_day_-_see_the_light_silverlight_3_is_finally_out.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-07-10/today_is_the_day_-_see_the_light_silverlight_3_is_finally_out.aspx eb1c1e4a-34e3-475f-bd86-d5601975c580 Fri, 10 Jul 2009 07:47:02 GMT Silverlight 3 to launch July 10 <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-Silverlight3tolaunchJuly10_B3B5-silverlight3_2.sflb"><img title="silverlight3" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="479" alt="silverlight3" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-Silverlight3tolaunchJuly10_B3B5-silverlight3_thumb.sflb" width="644" border="0" /></a> </p> <p>More info @ <a title="http://blogs.zdnet.com/microsoft/?p=2912" href="http://blogs.zdnet.com/microsoft/?p=2912">http://blogs.zdnet.com/microsoft/?p=2912</a></p> <p>Enjoy! :)</p> http://blogs.telerik.com/VladimirEnchev/Posts/09-05-29/silverlight_3_to_launch_july_10.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-05-29/silverlight_3_to_launch_july_10.aspx 9fcbe3d1-2b76-4162-91e8-c47235707c7c Fri, 29 May 2009 04:47:04 GMT How To: Twitter search with RadGridView for Silverlight and Twitter REST API <p>I’ve made small demo application on how to search <a href="http://twitter.com/" target="_blank">Twitter</a> using <a href="http://apiwiki.twitter.com/REST+API+Documentation" target="_blank">Twitter REST API</a> and <a href="http://demos.telerik.com/silverlight/#GridView/FirstLook" target="_blank">RadGridView for Silverlight</a>:&#160; <br /><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-TwittersearchwithRadGridViewforSilverlig_DAA7-TwitterSearch_4.sflb"><img title="TwitterSearch" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="346" alt="TwitterSearch" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-TwittersearchwithRadGridViewforSilverlig_DAA7-TwitterSearch_thumb_1.sflb" width="678" border="0" /></a> </p> <p>To download Twitter ATOM response you can use simple <a href="http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx" target="_blank">WebClient</a>: <br /> <br /><span style="color: blue">if </span>(!<span style="color: #2b91af">String</span>.IsNullOrEmpty(TextBox1.Text)) <br />{ <br />&#160;&#160;&#160; <span style="color: #2b91af">WebClient </span>client = <span style="color: blue">new </span><span style="color: #2b91af">WebClient</span>(); <br />&#160;&#160;&#160; client.DownloadStringCompleted += <span style="color: blue">new</span><span style="color: #2b91af">DownloadStringCompletedEventHandler</span>(client_DownloadStringCompleted); <br />&#160;&#160;&#160; <span style="color: blue">if</span>(!client.IsBusy) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; client.DownloadStringAsync(<span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(<span style="color: #2b91af">String</span>.Format(urlFormat, TextBox1.Text, pageSize, currentPageIndex))); <br />}</p> <a href="http://11011.net/software/vspaste"></a> <p>and you can parse the response using <a href="XDocument.Parse() " target="_blank">XDocument.Parse()</a> method: <br /> <br /><span style="color: #2b91af">XNamespace </span>atomNamespace = <span style="color: #a31515">&quot;http://www.w3.org/2005/Atom&quot;</span>; <br />RadGridView1.ItemsSource = <span style="color: blue">from </span>item <span style="color: blue">in </span><span style="color: #2b91af">XDocument</span>.Parse(e.Result).Descendants(atomNamespace + <span style="color: #a31515">&quot;entry&quot;</span>)&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">select new </span><span style="color: #2b91af">TwitterEntry <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{ <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ID = item.Element(atomNamespace + <span style="color: #a31515">&quot;id&quot;</span>).Value, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Published = <span style="color: #2b91af">DateTime</span>.Parse(item.Element(atomNamespace + <span style="color: #a31515">&quot;published&quot;</span>).Value), <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Url = item.Element(atomNamespace + <span style="color: #a31515">&quot;link&quot;</span>).Attribute(<span style="color: #a31515">&quot;href&quot;</span>).Value, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Title = item.Element(atomNamespace + <span style="color: #a31515">&quot;title&quot;</span>).Value, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Content = item.Element(atomNamespace + <span style="color: #a31515">&quot;content&quot;</span>).Value, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Updated = <span style="color: #2b91af">DateTime</span>.Parse(item.Element(atomNamespace + <span style="color: #a31515">&quot;updated&quot;</span>).Value), <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ImageUrl = item.Descendants(atomNamespace + <span style="color: #a31515">&quot;link&quot;</span>).Last().LastAttribute.Value, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Author = <span style="color: blue">new </span><span style="color: #2b91af">TwitterAuthor</span>() <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Name = ((<span style="color: #2b91af">XElement</span>) item.Element(atomNamespace + <span style="color: #a31515">&quot;author&quot;</span>).FirstNode).Value, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Url = ((<span style="color: #2b91af">XElement</span>) item.Element(atomNamespace + <span style="color: #a31515">&quot;author&quot;</span>).LastNode).Value <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; };</p> <p>Enjoy!</p> <p>[<a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/SilverlightGridWithTwitter.sflb?download=true">Download</a>]</p> http://blogs.telerik.com/VladimirEnchev/Posts/09-05-18/how_to_twitter_search_with_radgridview_for_silverlight_and_twitter_rest_api.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-05-18/how_to_twitter_search_with_radgridview_for_silverlight_and_twitter_rest_api.aspx c402efc1-b323-4cc9-b515-61c3585051e9 Mon, 18 May 2009 01:23:10 GMT Lightweight DataTable for your Silverlight applications <p><strong>UPDATE: </strong><a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/SilverlightDataTable_Q3_2009_SP2.sflb?download=true">Latest version (without Dynamic LINQ) with INotifyCollectionChanged and INotifyPropertyChanged support!!!</a></p> <p>(<a href="../../stefandobrev/posts.aspx">kudos to Stefan</a>)</p> <p>&nbsp;</p> <p>&nbsp;</p> <p></p> <p>Since there is no <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx">DataTable</a> in Silverlight I’ve created small class that can be used to generate columns and rows in runtime in similar to the real DataTable way:</p> <pre class="code"><span style="color: #2b91af;">DataTable </span>table = <span style="color: blue;">new </span><span style="color: #2b91af;">DataTable</span>();<br /><br />table.Columns.Add(<span style="color: blue;">new </span><span style="color: #2b91af;">DataColumn</span>() { ColumnName = <span style="color: #a31515;">"ID"</span>, DataType = <span style="color: blue;">typeof</span>(<span style="color: blue;">int</span>) });<br />table.Columns.Add(<span style="color: blue;">new </span><span style="color: #2b91af;">DataColumn</span>() { ColumnName = <span style="color: #a31515;">"Name"</span>, DataType = <span style="color: blue;">typeof</span>(<span style="color: blue;">string</span>) });<br />table.Columns.Add(<span style="color: blue;">new </span><span style="color: #2b91af;">DataColumn</span>() { ColumnName = <span style="color: #a31515;">"UnitPrice"</span>, DataType = <span style="color: blue;">typeof</span>(<span style="color: blue;">decimal</span>) });<br />table.Columns.Add(<span style="color: blue;">new </span><span style="color: #2b91af;">DataColumn</span>() { ColumnName = <span style="color: #a31515;">"Date"</span>, DataType = <span style="color: blue;">typeof</span>(<span style="color: #2b91af;">DateTime</span>) });<br />table.Columns.Add(<span style="color: blue;">new </span><span style="color: #2b91af;">DataColumn</span>() { ColumnName = <span style="color: #a31515;">"Discontinued"</span>, DataType = <span style="color: blue;">typeof</span>(<span style="color: blue;">bool</span>) });<br /><br /><span style="color: blue;">for</span>(<span style="color: blue;">var </span>i = 0; i &lt; 1000; i++)<br />{<br /> <span style="color: #2b91af;">DataRow </span>row = <span style="color: blue;">new </span><span style="color: #2b91af;">DataRow</span>();<br /> row[<span style="color: #a31515;">"ID"</span>] = i;<br /> row[<span style="color: #a31515;">"Name"</span>] = names[rnd.Next(9)];<br /> row[<span style="color: #a31515;">"UnitPrice"</span>] = prizes[rnd.Next(9)];<br /> row[<span style="color: #a31515;">"Date"</span>] = <span style="color: #2b91af;">DateTime</span>.Now.AddDays(i);<br /> row[<span style="color: #a31515;">"Discontinued"</span>] = bools[rnd.Next(9)];<br /><br /> table.Rows.Add(row);<br />}</pre> <p><a target="_blank" href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx">Dynamic LINQ</a> made all these possible! </p> <p>Enjoy!</p> <p>[<a href="http://blogs.telerik.com/Libraries/Vladimir_Enchev/SilverlightDataTable_2009_1109.sflb?download=true">Download</a>]</p> http://blogs.telerik.com/VladimirEnchev/Posts/09-04-23/lightweight_datatable_for_your_silverlight_applications.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-04-23/lightweight_datatable_for_your_silverlight_applications.aspx 2ff52a8f-dfd7-4d43-9003-f98f53e2fb35 Thu, 23 Apr 2009 07:58:43 GMT Full support for DomainDataSource with RadGridView for Silverlight 3 <p>I'm happy to announce that with our next service pack you will be able to bind <a href="http://demos.telerik.com/silverlight/default.aspx#GridView/FirstLook" target="_blank">RadGridView</a> completely codeless to <a href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2009/04/04/build-a-simple-application-with-net-ria-services-silverlight-3.aspx" target="_blank">DomainDataSource in Silverlight 3</a>:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-FullsupportforDomainDataSourcewithRadGri_B97E-Untitled_2.sflb"><img title="Untitled" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="424" alt="Untitled" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-FullsupportforDomainDataSourcewithRadGri_B97E-Untitled_thumb.sflb" width="645" border="0" /></a> </p> <pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">Grid.RowDefinitions</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">RowDefinition </span><span style="color: blue">/&gt; &lt;</span><span style="color: #a31515">RowDefinition </span><span style="color: red">Height</span><span style="color: blue">=</span>&quot;<span style="color: blue">30</span>&quot; <span style="color: blue">/&gt; &lt;/</span><span style="color: #a31515">Grid.RowDefinitions</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">riaControls:DomainDataSource </span><span style="color: red">x:Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">DomainDataSource1</span>&quot; <span style="color: red">AutoLoad</span><span style="color: blue">=</span>&quot;<span style="color: blue">True</span>&quot; <span style="color: red">LoadMethodName</span><span style="color: blue">=</span>&quot;<span style="color: blue">LoadCustomers</span>&quot;<span style="color: blue">&gt; &lt;</span><span style="color: #a31515">riaControls:DomainDataSource.DomainContext</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">localWeb:NorthwindDomainContext </span><span style="color: blue">/&gt; &lt;/</span><span style="color: #a31515">riaControls:DomainDataSource.DomainContext</span><span style="color: blue">&gt; &lt;/</span><span style="color: #a31515">riaControls:DomainDataSource</span><span style="color: blue">&gt; &lt;</span><span style="color: #a31515">telerik:RadGridView </span><span style="color: red">x:Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">RadGridView1</span>&quot; <span style="color: red">ItemsSource</span><span style="color: blue">=</span>&quot;<span style="color: blue">{Binding Data, ElementName=DomainDataSource1}</span>&quot; /<span style="color: blue">&gt; </span><span style="color: blue"> &lt;</span><span style="color: #a31515">df:DataPager </span><span style="color: red">x:Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">DataPager1</span>&quot; <span style="color: red">Grid.Row</span><span style="color: blue">=</span>&quot;<span style="color: blue">1</span>&quot; <span style="color: red">PageSize</span><span style="color: blue">=</span>&quot;<span style="color: blue">10</span>&quot; <span style="color: red">Source</span><span style="color: blue">=</span>&quot;<span style="color: blue">{Binding Data, ElementName=DomainDataSource1}</span>&quot; <span style="color: blue">/&gt; &lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;</span></pre> <a href="http://11011.net/software/vspaste"></a> <p>All operations like paging, sorting and grouping are applied to the REST query with minimal JSON response: </p> <p></p> <p></p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-FullsupportforDomainDataSourcewithRadGri_B97E-Untitled1_6.sflb"><img title="Untitled1" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="165" alt="Untitled1" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-FullsupportforDomainDataSourcewithRadGri_B97E-Untitled1_thumb_2.sflb" width="817" border="0" /></a> </p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-FullsupportforDomainDataSourcewithRadGri_B97E-Untitled2_2.sflb"><img title="Untitled2" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="112" alt="Untitled2" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-FullsupportforDomainDataSourcewithRadGri_B97E-Untitled2_thumb.sflb" width="759" border="0" /></a></p> <p>Enjoy!</p> http://blogs.telerik.com/VladimirEnchev/Posts/09-04-16/full_support_for_domaindatasource_with_radgridview_for_silverlight_3.aspx Vladimir Enchev http://blogs.telerik.com/VladimirEnchev/Posts/09-04-16/full_support_for_domaindatasource_with_radgridview_for_silverlight_3.aspx 6e2cf6ea-fbe2-445c-b24e-75eb01ead282 Thu, 16 Apr 2009 05:43:13 GMT