﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - ClientUI - Defaultsorting in UXGridView</title><link>http://www.intersoftsolutions.com/Community/ClientUI/Defaultsorting-in-UXGridView/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Defaultsorting in UXGridView</title><link>http://www.intersoftsolutions.com/Community/ClientUI/Defaultsorting-in-UXGridView/</link><pubDate>Fri, 04 Nov 2011 05:55:46 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Data sorting can be handled in either client or server side.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Client data operation means that the data operation such as sorting is executed in client against the data source provided to UXGridView.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Server data operation means that the data operation such as sorting is processed in server rather than in client. When this mode is selected, UXGridView will not attempt to perform the data operation on the given data source. Instead, it will store and distribute the query information to the SortDescriptors property. When the collection changes, the QueryChanged event of the associated QueryDescriptor will be raised. This allows you to streamline the query processing in a centralized function, which is one of the strong benefits of QueryDescriptor.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;To implement a predefined sorting, you can specify the SortDescriptions (in xaml code) or SortDescriptors property (in view model). The SortDescriptions is used when the control is configured with sorting client data operation, while the SortDescriptors is used for server data operation.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;The “query running twice” only happens on the server data operation (please check that by using the SortDescriptions approach, the query only run one times). Each time the collection change, the OnQueryChange event of the associated QueryDescriptor is raised. The first query is used to load the data and the next one is sort the data at the server.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Defaultsorting in UXGridView</title><link>http://www.intersoftsolutions.com/Community/ClientUI/Defaultsorting-in-UXGridView/</link><pubDate>Thu, 03 Nov 2011 04:43:47 GMT</pubDate><dc:creator>mg@hsig.ch</dc:creator><description>&lt;p&gt;Hi Yudi&lt;/p&gt;
&lt;p&gt;Thanks for sample.&lt;/p&gt;
&lt;p&gt;The only difference was that I had not deleted the properties SortDescriptors, PageDescriptor, FilterDescriptors at the UXGridView. Now it works, but without paging, and filtering!&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;Intersoft:UXGridView Intersoft:DockPanel.IsFillElement="True" AutoGenerateColumns="true" QueryOperation="Server"
                        GroupFootersVisibility="Visible" GroupByBoxVisibility="Visible" RowHeaderVisibility="Visible"
                        CanUserAddRows="True" CanUserDeleteRows="True" CanUserEditRows="True" CanUserPage="True" PageSize="20" 
                        SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemsSource="{Binding Path=Items}"
                        IsBusy="{Binding IsBusy, Mode=TwoWay}" IsRefreshed="{Binding IsRefreshed, Mode=TwoWay}"
                        NewItem="{Binding NewItem, Mode=TwoWay}"
                        ValidateRowCommand="{Binding ValidateRowCommand}" InsertRowCommand="{Binding InsertRowCommand}"
                        DeleteRowCommand="{Binding DeleteRowCommand}" PrepareNewRowCommand="{Binding PrepareNewRowCommand}"
                        UpdateCellCommand="{Binding UpdateCellCommand}" UpdateRowCommand="{Binding UpdateRowCommand}"
                        SaveChangesCommand="{Binding SaveChangesCommand}" RejectRowCommand="{Binding RejectRowCommand}"
                        RejectChangesCommand="{Binding RejectChangesCommand}" HasChanges="{Binding HasChanges}"
                        AutoEditOperation="{Binding AutoEditOperation}"&amp;gt;
    
&amp;lt;!--SortDescriptors="{Binding QueryDescriptor.SortDescriptors, Mode=TwoWay}"
PageDescriptor="{Binding QueryDescriptor.PageDescriptor}"
FilterDescriptors="{Binding QueryDescriptor.FilterDescriptors, Mode=TwoWay}"--&amp;gt;&lt;/pre&gt;

&lt;p&gt;Perhaps it is easier to define the sorting in the constructor. Just yet, the question is why the query twice running.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Michael&lt;/p&gt;</description></item><item><title>Defaultsorting in UXGridView</title><link>http://www.intersoftsolutions.com/Community/ClientUI/Defaultsorting-in-UXGridView/</link><pubDate>Wed, 26 Oct 2011 02:36:20 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;I tested the “SortDescriptions” (sorting in xaml) by creating a project using the “Intersoft ClientUI MVVM Data Application (WCF RIA SP1)” and modify the Products.xaml page. The modified version of Products.xaml is enclosed as attachment.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;I also tried the “SortDescriptions” in Customers.xaml. First, I follow every step in “Walkthrough: Bind UXGridView to WCF RIA Services using MVVM Pattern” article that available in the ClientUI’s documentation and add the “SortDescriptions” as shown in my previous post (sorting “Country” in descending direction).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;Should you have any difficulties apply sorting in xaml by using the same method, please let me know. I’d be glad to provide you with complete project if necessary.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;Thank you and have a nice day.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Defaultsorting in UXGridView</title><link>http://www.intersoftsolutions.com/Community/ClientUI/Defaultsorting-in-UXGridView/</link><pubDate>Tue, 25 Oct 2011 04:46:09 GMT</pubDate><dc:creator>mg@hsig.ch</dc:creator><description>&lt;p&gt;Hi Yudi&lt;/p&gt;
&lt;p&gt;Sorting in xaml does not work! I have tested on Products Page (Client UI Sample).  I have added the SortDescriptiors and commented out the GroupDescriptor as follow:&lt;/p&gt;&lt;pre&gt;&amp;lt;!--&amp;lt;Intersoft:UXGridView.GroupDescriptors&amp;gt;
    &amp;lt;Intersoft:UXGridViewGroupDescriptor PropertyName="CategoryID"/&amp;gt;
&amp;lt;/Intersoft:UXGridView.GroupDescriptors&amp;gt;--&amp;gt;
&amp;lt;Intersoft:UXGridView.SortDescriptions&amp;gt;
    &amp;lt;ComponentModel:SortDescription PropertyName="CategoryID" Direction="Ascending"/&amp;gt;
&amp;lt;/Intersoft:UXGridView.SortDescriptions&amp;gt;&lt;/pre&gt;

&lt;p&gt;In query orderby is not added!&lt;/p&gt;
&lt;p&gt;Adding SortDescriptor in the constructor works fine (exept run twice).&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Michael&lt;/p&gt;</description></item><item><title>Defaultsorting in UXGridView</title><link>http://www.intersoftsolutions.com/Community/ClientUI/Defaultsorting-in-UXGridView/</link><pubDate>Wed, 19 Oct 2011 07:26:52 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;In order to implement a predefined sorting in XAML, please try to use following snippet code.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;Intersoft:UXGridView.SortDescriptions&amp;gt;
    &amp;lt;ComponentModel:SortDescription PropertyName="Country" Direction="Descending"/&amp;gt;
&amp;lt;/Intersoft:UXGridView.SortDescriptions&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;The “ComponentModel” namespace needs to be defined in the XAML using:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;xmlns:ComponentModel="clr-namespace:System.ComponentModel;assembly=System.Windows"&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;Adding SortDescriptor in the constructor of ViewModel can be achieved by using following code.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;this.QueryDescriptor.SortDescriptors.Add(new SortDescriptor() { PropertyName = "Country", Direction = ListSortDirection.Descending });&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;When using this technique, the QueryDescriptor instance is set with SortDescriptors collection which provides the required information for data query purpose. The SortDescriptors collection consist of a single SortDescriptor where PropertyName is set to “Country” and Direction is set to “Descending”.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;Defining SortDescriptor in XAML as shown in the following code is not going to work because the SortDescriptor that defined in XAML unable to set the QueryDescriptor in the ViewModel.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;Intersoft:UXGridView.SortDescriptors&amp;gt;
    &amp;lt;Intersoft:SortDescriptor PropertyName="Country" Direction="Descending" /&amp;gt;
&amp;lt;/Intersoft:UXGridView.SortDescriptors&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;I need to discuss about why the “LoadData” run twice with the UXGridView development team does. I’ll update to you as soon as I received any news from the team.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Defaultsorting in UXGridView</title><link>http://www.intersoftsolutions.com/Community/ClientUI/Defaultsorting-in-UXGridView/</link><pubDate>Tue, 18 Oct 2011 10:28:08 GMT</pubDate><dc:creator>mg@hsig.ch</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I have still a problem with sorting in UXGridView. I want to sort only by a specific column (no grouping). That is why I added a SortDescriptor in the constructor of ViewModel. This has been discussed in &lt;a href="http://intersoftpt.com/Community/ClientUI/ClientUI-MVVM-Data-Application-template-reusable-code-Grouping-CopyPaste/" target="_blank"&gt;this thread&lt;/a&gt;. Now I have found that always the first LoadData command twice is running! Have a look on attached picture. Can you explain to why this is so?&lt;/p&gt;
&lt;p&gt;Why can I not define SortDescriptor in XAML? Would this change something?&lt;/p&gt;&lt;pre&gt;&amp;lt;Intersoft:UXGridView.SortDescriptors&amp;gt;
        &amp;lt;Intersoft:
&amp;lt;/Intersoft:UXGridView.SortDescriptors&amp;gt;&lt;/pre&gt;

&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Michael&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item></channel></rss>