Class GridFilterControl
Represents a control that contains the details about how to filter the data in SfDataGrid by using the filter popup in GridFilterControl.
Inheritance
Implements
Namespace: Syncfusion.UI.Xaml.Grid
Assembly: Syncfusion.SfGrid.WPF.dll
Syntax
public class GridFilterControl : ContentControl, IDisposable, INotifyPropertyChanged
Constructors
GridFilterControl()
Initializes a new instance of the GridFilterControl class.
Declaration
public GridFilterControl()
Fields
AdvancedFilterStyleProperty
Identifies the AdvancedFilterStyle dependency property.
Declaration
public static readonly DependencyProperty AdvancedFilterStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the AdvancedFilterStyle dependency property.
AllowBlankFiltersProperty
Identifies the AllowBlankFilters dependency property.
Declaration
public static readonly DependencyProperty AllowBlankFiltersProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the AllowBlankFilters dependency property.
AscendingSortStringProperty
Identifies the AscendingSortString dependency property.
Declaration
public static readonly DependencyProperty AscendingSortStringProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the AscendingSortString dependency property.
CheckboxFilterStyleProperty
Identifies the CheckboxFilterStyle dependency property.
Declaration
public static readonly DependencyProperty CheckboxFilterStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the CheckboxFilterStyle dependency property.
DescendingSortStringProperty
Identifies the DescendingSortString dependency property.
Declaration
public static readonly DependencyProperty DescendingSortStringProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the DescendingSortString dependency property.
FilterColumnTypeProperty
Identifies the FilterColumnType dependency property.
Declaration
public static readonly DependencyProperty FilterColumnTypeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the FilterColumnType dependency property.
FilteredFromProperty
Identifies the FilteredFrom dependency property.
Declaration
public static readonly DependencyProperty FilteredFromProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the FilteredFrom dependency property.
FilterModeProperty
Identifies the FilterMode dependency property.
Declaration
public static readonly DependencyProperty FilterModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the FilterMode dependency property.
FilterPopUp
Gets or sets the filter pop up.
Declaration
public Popup FilterPopUp
Field Value
Type | Description |
---|---|
System.Windows.Controls.Primitives.Popup | The filter pop up. |
FilterPopupHeightProperty
Identifies the FilterPopupHeight dependency property.
Declaration
public static readonly DependencyProperty FilterPopupHeightProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the FilterPopupHeight dependency property.
FilterPopupWidthProperty
Identifies the FilterPopupWidth dependency property.
Declaration
public static readonly DependencyProperty FilterPopupWidthProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the FilterPopupWidth dependency property.
ImmediateUpdateColumnFilterProperty
Identifies the ImmediateUpdateColumnFilter dependency property.
Declaration
public static readonly DependencyProperty ImmediateUpdateColumnFilterProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the ImmediateUpdateColumnFilter dependency property.
IsAdvancedFilterVisibleProperty
Identifies the IsAdvancedFilterVisible dependency property.
Declaration
public static readonly DependencyProperty IsAdvancedFilterVisibleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the IsAdvancedFilterVisible dependency property.
IsOpenProperty
Identifies the IsOpen dependency property.
Declaration
public static readonly DependencyProperty IsOpenProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the IsOpen dependency property.
ResizingThumbVisibilityProperty
Identifies the ResizingThumbVisibility dependency property.
Declaration
public static readonly DependencyProperty ResizingThumbVisibilityProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the ResizingThumbVisibility dependency property.
SortOptionVisibilityProperty
Identifies the SortOptionVisibility dependency property.
Declaration
public static readonly DependencyProperty SortOptionVisibilityProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the SortOptionVisibility dependency property.
Properties
AdvancedFilterStyle
Gets or sets the style applied to AdvancedFilterControl.
Declaration
public Style AdvancedFilterStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Style | The style which is applied to AdvancedFilterControl in SfDataGrid. The default value is null. |
Remarks
To define a System.Windows.Style for a AdvancedFilter, specify a TargetType of AdvancedFilterControl.
AdvancedFilterType
Gets or sets AdvancedFilterType for GridFilterControl.
Declaration
public AdvancedFilterType AdvancedFilterType { get; set; }
Property Value
Type | Description |
---|---|
AdvancedFilterType | One of the AdvancedFilterType enumeration that specifies which Advanced filter type needs to be loaded. The default value is TextFilter. |
AllowBlankFilters
Gets or sets a value indicating whether to allow the Blank Filters.
Declaration
public bool AllowBlankFilters { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true;otherwise, false. |
Remarks
In CheckboxFilterControl you can filter the null values by using the Blanks checkbox. You can filter the Null and NotNull values from the underlying data source by using this property in AdvancedFilterControl.
AscendingSortString
Gets or sets the text content to the AscendingSortButton in GridFilterControl.
Declaration
public string AscendingSortString { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string that specifies the AscendingSortString of GridFilterControl. The default value is |
Remarks
The value of AscendingSortString is updated from GridLocalizationResources by using the key SortStringAscending.
Examples
this.sfDataGrid.FilterItemsPopulating += sfDataGrid_FilterItemsPopulating;
void sfDdataGrid_FilterItemsPopulating(object sender, Syncfusion.UI.Xaml.Grid.GridFilterItemsPopulatingEventArgs e)
{
if (e.Column.MappingName == "OrderID")
{
e.FilterControl.AscendingSortString = GridLocalizationResourceAccessor.Instance.GetLocalizedStringResource("SortStringAscending");
e.FilterControl.DescendingSortString = GridLocalizationResourceAccessor.Instance.GetLocalizedStringResource("SortStringDescending");
}
}
CheckboxFilterStyle
Gets or sets the style applied to CheckboxFilterControl.
Declaration
public Style CheckboxFilterStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Style | The style which is applied to CheckboxFilterControl in SfDataGrid. The default value is null. |
Remarks
To define a System.Windows.Style for a CheckboxFilter, specify a TargetType of CheckboxFilterControl.
DescendingSortString
Gets or sets the text content to the DescendingSortButton in GridFilterControl.
Declaration
public string DescendingSortString { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string that specifies DescendingSortString of GridFilterControl. The default value is |
Remarks
The value of DescendingSortString is updated from GridLocalizationResources by using the key SortStringDescending.
FilterColumnType
Gets or sets a value that indicates the FilterColumnType in GridFilterControl.Which is used to show the text content of the AdvancedFilterButton in GridFilterControl.
Declaration
public string FilterColumnType { get; set; }
Property Value
Type | Description |
---|---|
System.String | FilterColumnType is used to show which type of AdvancedFilter is loaded in GridFilterCntrol.The default value of FilterColumnType is TextFilters. |
Remarks
Whenever the AdvancedFilterType property is changed at that time the FilterColumnType is also gets updated to show the AdvancedFilterType text in AdvancedFilterButton.
FilteredFrom
Gets or sets a value indicating whether column is filtered from Checkbox or Advanced filter.
Declaration
public FilteredFrom FilteredFrom { get; set; }
Property Value
Type | Description |
---|---|
FilteredFrom | One of the FilteredFrom enumeration that specifies the FilteredFrom The default filtered from value is None. |
FilterMode
Gets or sets a value to specify the FilterMode in GridFilterControl.
Declaration
public FilterMode FilterMode { get; set; }
Property Value
Type | Description |
---|---|
FilterMode | One of the FilterMode enumeration that specifies the FilterMode in SfDataGrid The default filter mode is Both. |
FilterPopupHeight
Gets or sets the height for the filter popup.
Declaration
public double FilterPopupHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is 450.00d |
Examples
<Grid.Resources>
<Style TargetType="dataGrid:GridFilterControl" x:Key="gridFilterControlStyle">
<Setter Property="FilterPopupHeight" Value="300"/>
<Setter Property="FilterPopupWidth" Value="250"/>
</Style>
</Grid.Resources>
<dataGrid:SfDataGrid x:Name="sfDataGrid"
FilterPopupStyle="{StaticResource gridFilterControlStyle}"
ItemsSource="{Binding Orders}"/>
FilterPopupWidth
Gets or sets width for filter popup.
Declaration
public double FilterPopupWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is 300.00d |
Examples
<Grid.Resources>
<Style TargetType="dataGrid:GridFilterControl" x:Key="gridFilterControlStyle">
<Setter Property="FilterPopupHeight" Value="300"/>
<Setter Property="FilterPopupWidth" Value="250"/>
</Style>
</Grid.Resources>
<dataGrid:SfDataGrid x:Name="sfDataGrid"
FilterPopupStyle="{StaticResource gridFilterControlStyle}"
ItemsSource="{Binding Orders}"/>
ImmediateUpdateColumnFilter
Gets or sets a value indicating whether ImmediateUpdateColumnFilter.
Declaration
public bool ImmediateUpdateColumnFilter { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value istrue; otherwise, false. |
Remarks
You can filter the data immediately from the filter popup. For example you can filter the data from CheckboxFilterControl by check and uncheck the checkbox items. And Syncfusion.UI.Xaml.Grid.GridFilterControl.OkButton , Syncfusion.UI.Xaml.Grid.GridFilterControl.CancelButton will not be shown in the filter popup while enable the ImmediateUpdateColumnFilter.
IsAdvancedFilterVisible
Gets or sets a value that indicates whether the AdvancedFilter is visible or not.
Declaration
public bool IsAdvancedFilterVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if AdvancedFilter is visible; otherwise,false. The default value is false. |
IsOpen
Gets or sets a value that indicates whether the filter popup is opened or not.
Declaration
public bool IsOpen { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the filter popup is opened; otherwise, false. The default value is false. |
ResizingThumbVisibility
Gets or sets a value indicating the ResizingThumb Visibility
Declaration
public Visibility ResizingThumbVisibility { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Visibility | One of the System.Windows.Visibility enumeration that specifies the visibility of ResizingThumb The default mode is System.Windows.Visibility.Visible. |
SortOptionVisibility
Gets or sets a value indicating the SortOptionVisibility.
Declaration
public Visibility SortOptionVisibility { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Visibility | One of the System.Windows.Visibility enumeration that specifies the visibility of SortOption. The default mode is System.Windows.Visibility.Visible. |
Methods
Dispose()
Disposes all the resources used by the GridFilterControl class.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes all the resources used by the GridFilterControl class.
Declaration
protected virtual void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing | Indicates whether the call is from Dispose method or from a finalizer. |
GetFormattedString(Object)
Gets the formatted string for the actual value of the corresponding record in the filter column.
Declaration
public string GetFormattedString(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | Which holds the actual value of the corresponding record in the filter column. |
Returns
Type | Description |
---|---|
System.String | Returns the formatted string for the actual value of the corresponding record in the filter column. |
OnApplyTemplate()
Builds the visual tree for the GridFilterControl when a new template is applied.
Declaration
public override void OnApplyTemplate()
OnKeyDown(KeyEventArgs)
Called before the KeyDown event occurs.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e | The System.Windows.Input.KeyEventArgs contains the event data. |
OnMouseLeftButtonDown(MouseButtonEventArgs)
Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e |
OnMouseLeftButtonUp(MouseButtonEventArgs)
Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e |
OnMouseMove(MouseEventArgs)
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e |
OnMouseWheel(MouseWheelEventArgs)
Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseWheelEventArgs | e |
OnPropertyChanged(String)
Invoked when the PropertyChanged event occurs.
Declaration
public void OnPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The corresponding property name. |
SetColumnDataType(Type)
Sets the filtered column dataType to the AdvancedFilterControl.Which is used to validate the entered value in the Textbox or ComboBox in the AdvancedFilterControl while applying the filter.
Declaration
public void SetColumnDataType(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | It specifies the Type and it will be a string or DateTime or object. |
Examples
this.sfDataGrid.FilterItemsPopulating += sfDataGrid_FilterItemsPopulating;
void sfDdataGrid_FilterItemsPopulating(object sender, Syncfusion.UI.Xaml.Grid.GridFilterItemsPopulatingEventArgs e)
{
if (e.Column.MappingName == "OrderID")
{
e.FilterControl.AdvancedFilterType = AdvancedFilterType.TextFilter;
e.FilterControl.SetColumnDataType(typeof(string));
}
}
Events
OkButtonClick
Occurs when the OkButton is clicked
Declaration
public event EventHandler<OkButtonClikEventArgs> OkButtonClick
Event Type
Type |
---|
System.EventHandler<OkButtonClikEventArgs> |
OnFilterElementChanged
Occurs when the FilterElement is changed.
Declaration
public event EventHandler<OnFilterElementPropertyChangedEventArgs> OnFilterElementChanged
Event Type
Type |
---|
System.EventHandler<OnFilterElementPropertyChangedEventArgs> |
PopupOpened
Occurs when the filter Popup is opened.
Declaration
public event EventHandler<PopupOpenedEventArgs> PopupOpened
Event Type
Type |
---|
System.EventHandler<PopupOpenedEventArgs> |
PropertyChanged
Occurs when a property value changes.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type |
---|
System.ComponentModel.PropertyChangedEventHandler |