How to use?
Download the binary file and add it into Silverlight Project => ReferencesIn XAML on page that you need to add this control, add next lines (i recommend to mix control with TabControl):
<UserControl //... // Define controls namespaces xmlns:ria="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria" xmlns:ctl="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:ctlRia="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria" // Define Server app that have RIA Services xmlns:srvApp="clr-namespace:<OUR_SERVER_APP_PROJECT_NAME_THAT_HAVE_RIA_SERVICES>" // Define RIA Services DataFilter Control xmlns:riaDataFilter="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.RIADataFilter.Control" > <UserControl.Resources> <ctlRia:DomainDataSource x:Name="ddsCustomer" QueryName="GetCustomers" AutoLoad="True"> <ctlRia:DomainDataSource.DomainContext> <srvApp:<RIA_SERVICES_DOMAIN_CONTEXT> /> </ctlRia:DomainDataSource.DomainContext> </ctlRia:DomainDataSource> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <ctl:TabControl> <ctl:TabItem Header="Filtering" IsSelected="True"> <riaDataFilter:DataFilter x:Name="RiaDataFilter1" DomainDataSource="{Binding ElementName=ddsCustomer}" /> </ctl:TabItem> <ctl:TabItem Header="Sorting"> <riaDataFilter:DataSort x:Name="RiaDataFilter2" DomainDataSource="{Binding ElementName=ddsCustomer}" /> </ctl:TabItem> <ctl:TabItem Header="Grouping"> <riaDataFilter:DataGroup x:Name="RiaDataFilter3" DomainDataSource="{Binding ElementName=ddsCustomer}" /> </ctl:TabItem> </ctl:TabControl> </Grid> </UserControl>
How to Localize Control?
How to localize DataFilter
<riaDataFilter:DataFilter x:Name="RiaDataFilter1" ButtonAddFilterTooltip="Add filter" ButtonDeleteFilterTooltip="Remove filter" ButtonClearFilterTooltip="Clear filter" ButtonApplyContent="Apply" ButtonApplyTooltip="Apply filters" ButtonCancelContent="Cancel" ButtonCancelTooltip="Cancel filters" FilterPropertyPathHeader="PropertyPath column header name" FilterOperationHeader="Operator column header name" FilterValueHeader="Value column header name" />
How to localize DataSort
<riaDataFilter:DataSort x:Name="RiaDataFilter2" ButtonAddSortTooltip="Add sort" ButtonDeleteSortTooltip="Remove sort" ButtonClearSortTooltip="Clear sort" ButtonApplyContent="Apply" ButtonApplyTooltip="Apply sorts" ButtonCancelContent="Cancel" ButtonCancelTooltip="Cancel sorts" SortPropertyPathHeader="PropertyPath column header name" SortDirectionHeader="Direction column header name" />
How to localize DataGroup
<riaDataFilter:DataGroup x:Name="RiaDataFilter3" ButtonAddGroupTooltip="Add group" ButtonDeleteGroupTooltip="Remove group" ButtonClearGroupTooltip="Clear group" ButtonApplyContent="Apply" ButtonApplyTooltip="Apply groups" ButtonCancelContent="Cancel" ButtonCancelTooltip="Cancel groups" GroupPropertyPathHeader="PropertyPath column header name" />
How to localize FilterOperator's
<riaDataFilter:FilterOperatorLocalizationCollection x:Key="FilterLocalization"> <riaDataFilter:FilterOperatorLocalization Operator="Contains" Localization="Содержит"/> <riaDataFilter:FilterOperatorLocalization Operator="EndsWith" Localization="Заканчивается на"/> <riaDataFilter:FilterOperatorLocalization Operator="IsContainedIn" Localization="Содержится в"/> <!-...--> </riaDataFilter:FilterOperatorLocalizationCollection> <!-...--> <riaDataFilter:DataFilter x:Name="RiaDataFilter1" FilterOperatorLocalizationCollection="{StaticResource FilterLocalization}" />
How to localize SortDirection's
<riaDataFilter:SortDirectionLocalizationCollection x:Key="SortLocalization"> <riaDataFilter:SortDirectionLocalization Direction="Ascending" Localization="По возрастанию" /> <riaDataFilter:SortDirectionLocalization Direction="Descending" Localization="По убыванию" /> </riaDataFilter:SortDirectionLocalizationCollection> <!-...--> <riaDataFilter:DataSort x:Name="RiaDataFilter2" SortDirectionLocalizationCollection="{StaticResource SortLocalization}" />
How to use IncludeFieldList - only defined fields must be Included and showed at the ComboBox
<UserControl //... // Define RIA Services DataFilter Control xmlns:riaDataFilter="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.RIADataFilter.Control" xmlns:core="clr-namespace:System;assembly=mscorlib" > <UserControl.Resources> <core:String x:Key="includeFieldList">CompanyName, ContactName, ContactTitle</core:String> </UserControl.Resources> //... <riaDataFilter:DataFilter x:Name="RiaDataFilter1" DomainDataSource="{Binding ElementName=YOUR_DOMAINDATASOURCE}" IncludeFieldList="{StaticResource includeFieldList}" /> // BE SURE, YOU HAVE ORIGINAL COPY OF THE FIELDS FROM metadata FILE // Use IncludeFieldList for all of RIADataFilter controls like this
How to use ExcludeFieldList - defined fields must be Excluded from fields that showed at ComboBox
<UserControl //... // Define RIA Services DataFilter Control xmlns:riaDataFilter="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.RIADataFilter.Control" xmlns:core="clr-namespace:System;assembly=mscorlib" > <UserControl.Resources> <core:String x:Key="excludeFieldList">CustomerID</core:String> </UserControl.Resources> //... <riaDataFilter:DataFilter x:Name="RiaDataFilter1" DomainDataSource="{Binding ElementName=YOUR_DOMAINDATASOURCE}" ExcludeFieldList="{StaticResource excludeFieldList}" /> // BE SURE, YOU HAVE ORIGINAL COPY OF THE FIELDS FROM metadata FILE // Use ExcludeFieldList for all of RIADataFilter controls like this
How to use DomainEntityFieldCollection (User-frendly field names) - defines at client-side and replace names that comes from DomainContext metadata file
<UserControl //... // Define RIA Services DataFilter Control xmlns:riaDataFilter="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.RIADataFilter.Control" > <UserControl.Resources> <riaDataFilter:DomainEntityFieldCollection x:Key="DomainFieldCollection"> <riaDataFilter:DomainEntityField PropertyPath="Address" DisplayName="Client-Side Customer Address"/> <riaDataFilter:DomainEntityField PropertyPath="City" DisplayName="Client-Side Customer City"/> </riaDataFilter:DomainEntityFieldCollection> </UserControl.Resources> //... <riaDataFilter:DataFilter x:Name="RiaDataFilter1" DomainDataSource="{Binding ElementName=YOUR_DOMAINDATASOURCE}" DomainEntityFieldCollection="{StaticResource DomainFieldCollection}" /> // NOTE: DomainEntityFieldCollection have HIGH PRIORITY when get Fields from DomainDataSource, user-frendly names from DomainDataSource will be ignored // Use this for all of RIADataFilter controls like this