DataFilter for WinForms | ComponentOne
C1.Win.DataFilter.4.5.2 Assembly / C1.Win.DataFilter Namespace / RangeFilter Class
Members

In This Topic
    RangeFilter Class
    In This Topic
    Represents a filter with range slider or editors of range.
    Object Model
    RangeFilter Class
    Syntax
    'Declaration
     
    Public Class RangeFilter 
       Inherits C1.DataFilter.RangeFilterBase
    public class RangeFilter : C1.DataFilter.RangeFilterBase 
    Remarks

    This class is used to instantiate a filter which can be applied to the number type values. It helps to filter out the data based on the specified numeric range. The listing below provides the details about different options that can be set for the filter using this class.

    • Get or set the name of the data item property to which the current filter applies using the PropertyName property.
    • Set the header text of the filter using the HeaderText property and determine its visibility with the help of ShowHeader property.
    • Expand/Collapse the filter with the help of Expanded property.
    • The Maximum and Minimum properties are used to set the minimum and maximum values for the filtering numeric range.
    • Get or set the current lower/upper magnitude of the range with the help of LowerValue and UpperValue properties.
    • Display/Hide the filter editors using the EditorsVisible property and set their type to TextBox/SpinEditor using the EditorsType property.
    • Determine the visibility of the range slider using the SliderVisible property.
    • The Increment property lets you specify the amount to increment/decrement from the filter value, when using the up/down buttons of the editors or up/down keys or mouse.
    • Get or set the number of fractional digits that can appear in the filter value with the help of Digits property.
    • Retrieve the current filter expression with the help of Expression property.
    • The IsApplied property can be used to find whether the current filter is applied or not.
    Example

    private void InitializeRangeFilter()

    {

     //Initialize the RangeFilter
     RangeFilter rangeFilter = new RangeFilter();

     //Sets the name of the data item property to which the current filter applies
     rangeFilter.PropertyName = "Price";

     //Sets the header text of the filter
     rangeFilter.HeaderText = "Price";

     //Sets the maximum value of the range
     rangeFilter.Maximum = _carsTable.AsEnumerable().Max(x = >x.Field < double > ("Price"));

     //Sets the minimum value of the range
     rangeFilter.Minimum = _carsTable.AsEnumerable().Min(x = >x.Field < double > ("Price"));

     //Sets the type of editors to be shown
     rangeFilter.EditorsType = C1.DataFilter.EditorsType.SpinEditor;

     //Sets the amount to increment/decrement when using the up/down buttons of the editors or up/down keys or mouse wheel
     rangeFilter.Increment = 1000;

     //Sets the number of fractional digits
     rangeFilter.Digits = 0;

     //Adds the RangeFilter to the FilterCollection
     c1DataFilter1.Filters.Add(rangeFilter);

    }

    Inheritance Hierarchy

    System.Object
       C1.DataFilter.Filter
          C1.DataFilter.RangeFilterBase
             C1.Win.DataFilter.RangeFilter

    See Also