MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DataFormDateRangeAttribute

    Show / Hide Table of Contents

    Class DataFormDateRangeAttribute

    Specifies the date range constraints for the value of a data field.

    Inheritance
    System.Object
    DataFormDateRangeAttribute
    Namespace: Syncfusion.Maui.DataForm
    Assembly: Syncfusion.Maui.DataForm.dll
    Syntax
    public sealed class DataFormDateRangeAttribute : ValidationAttribute

    Constructors

    DataFormDateRangeAttribute()

    Initializes a new instance of the DataFormDateRangeAttribute class.

    Declaration
    public DataFormDateRangeAttribute()

    Properties

    DisplayFormat

    Gets or sets the attribute date display format of date editor.

    Declaration
    public string DisplayFormat { get; set; }
    Property Value
    Type Description
    System.String

    The default value is "dd/MM/yyyy".

    Examples

    The below examples shows, how to set the DisplayFormat property of DataFormDateRangeAttribute in the SfDataForm.

    • XAML
    • C#
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm"
                         DataObject="{Binding DateInfo}">
       <dataForm:SfDataForm.BindingContext>
         <local:DataFormViewModel/>
       </dataForm:SfDataForm.BindingContext>
    </dataForm:SfDataForm>
    public class DataFormViewModel
    {
       public DateInfo DateInfo { get;set; }
    }
    public class DateInfo
    {
      [DataFormDateRange(DisplayFormat = "dd/MMM/yyyy")]
       public DateTime JoinDate { get; set; }
    }
    this.dataForm.DataObject = new DataFormViewModel().DateInfo;

    MaximumDate

    Gets or sets the maximum date that users can assign to the date editor.

    Declaration
    public string MaximumDate { get; set; }
    Property Value
    Type Description
    System.String

    The default value is System.String.Empty.

    Examples

    The below examples shows, how to set the MaximumDate property of DataFormDateRangeAttribute in the SfDataForm.

    • XAML
    • C#
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm"
                         DataObject="{Binding DateInfo}">
       <dataForm:SfDataForm.BindingContext>
         <local:DataFormViewModel/>
       </dataForm:SfDataForm.BindingContext>
    </dataForm:SfDataForm>
    public class DataFormViewModel
    {
      public DateInfo DateInfo { get;set; }
    }
    public class DateInfo
    {
       [DataFormDateRange(MaximumDate = "01/11/2022")]
       public DateTime JoinDate { get; set; }
    }
    this.dataForm.DataObject = new DataFormViewModel().DateInfo;

    MinimumDate

    Gets or sets the minimum date that users can assign to the date editor.

    Declaration
    public string MinimumDate { get; set; }
    Property Value
    Type Description
    System.String

    The default value is System.String.Empty.

    Examples

    The below examples shows, how to set the MinimumDate property of DataFormDateRangeAttribute in the SfDataForm.

    • XAML
    • C#
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm"
                         DataObject="{Binding DateInfo}">
       <dataForm:SfDataForm.BindingContext>
         <local:DataFormViewModel/>
       </dataForm:SfDataForm.BindingContext>
    </dataForm:SfDataForm>
    public class DataFormViewModel
    {
       public DateInfo DateInfo { get;set; }
    }
    public class DateInfo
    {
       [DataFormDateRange(MinimumDate = "01/01/2022")]
       public DateTime JoinDate { get; set; }
    }
    this.dataForm.DataObject = new DataFormViewModel().DateInfo;

    Methods

    IsValid(Object)

    Checks that the value of the data field is in the specified range.

    Declaration
    public override bool IsValid(object value)
    Parameters
    Type Name Description
    System.Object value

    The data field value to validate.

    Returns
    Type Description
    System.Boolean

    True if the specified value is in the range; otherwise, false.

    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved