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

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

    This class is used to instantiate a filter which can be applied to the Date type values. It helps to filter out the data based on the specified date 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 date range.
    • Get or set the current lower/upper magnitude of the date 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.
    • 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 InitializeDateRangeFilter()

    {

     //Initialize the DateRangeFilter
     DateRangeFilter dateRangeFilter = new DateRangeFilter();

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

     //Sets the header text of the filter
     dateRangeFilter.HeaderText = "Order Date";

     //Sets the maximum value of the range
     dateRangeFilter.Maximum = _ordersTable.AsEnumerable().Max(x = >x.Field < DateTime > ("OrderDate"));

     //Sets the minimum value of the range
     dateRangeFilter.Minimum = _ordersTable.AsEnumerable().Min(x = >x.Field < DateTime > ("OrderDate"));

     //Sets the current lower magnitude of the range
     dateRangeFilter.LowerValue = new DateTime(2014, 10, 17);

     //Adds the DateRangeFilter to the FilterCollection
     c1DataFilter1.Filters.Add(dateRangeFilter);

    }

    Inheritance Hierarchy

    System.Object
       C1.DataFilter.Filter
          C1.DataFilter.DateRangeFilterBase
             C1.Win.DataFilter.DateRangeFilter

    See Also