Skip to main content

DateTimeRangeControlClient Class

A RangeControl‘s client that supports date-time range selection.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public class DateTimeRangeControlClient :
    RangeControlClientBase,
    IRangeControlClientEx

Remarks

A DateTimeRangeControlClient allows users to select a date-time range in a RangeControl.

image

image

Use the RangeControl.Client property to assign a DateTimeRangeControlClient to the RangeControl.

The following example demonstrates how to create and initialize the range control’s date client.

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace DXApplication1 {
    public partial class Form1 : XtraForm {
        RangeControl rangeControl1;
        DateTimeRangeControlClient dateTimeRangeControlClient1;

        public Form1() {
            InitializeComponent();
            rangeControl1 = new RangeControl();
            dateTimeRangeControlClient1 = new DateTimeRangeControlClient();
            DateTimeRangeClientRuler dateTimeRangeClientRuler1 = new DateTimeRangeClientRuler();
            DateTimeRangeClientRuler dateTimeRangeClientRuler2 = new DateTimeRangeClientRuler();
            ((ISupportInitialize)(this.rangeControl1)).BeginInit();
            this.SuspendLayout();
            // 
            // rangeControl1
            //
            rangeControl1.Client = dateTimeRangeControlClient1;
            rangeControl1.ContentPadding = new Padding(10);
            rangeControl1.Dock = DockStyle.Top;
            rangeControl1.FadeUnselectedArea = false;
            rangeControl1.Name = "rangeControl1";
            rangeControl1.SelectionType = RangeControlSelectionType.ThumbAndFlag;
            rangeControl1.Size = new Size(896, 150);
            rangeControl1.Text = "rangeControl1";
            // 
            // dateTimeRangeControlClient1
            //
            dateTimeRangeControlClient1.FlagFormatString = "{0:d}";
            dateTimeRangeControlClient1.LabelFormatString = "";
            dateTimeRangeControlClient1.Maximum = new DateTime(2021, 1, 1, 10, 22, 25, 0);
            dateTimeRangeControlClient1.Minimum = new DateTime(2019, 1, 1, 10, 22, 25, 0);
            dateTimeRangeControlClient1.RangeControl = this.rangeControl1;
            dateTimeRangeClientRuler1.MainRuler = true;
            dateTimeRangeClientRuler1.MinGridDelta = 25;
            dateTimeRangeClientRuler1.ShowInContentArea = true;
            dateTimeRangeClientRuler2.AllowAdaptiveTicks = true;
            dateTimeRangeClientRuler2.DrawSeparator = DevExpress.Utils.DefaultBoolean.False;
            dateTimeRangeClientRuler2.DrawTicks = DevExpress.Utils.DefaultBoolean.False;
            dateTimeRangeClientRuler2.LabelAlignment = Alignment.Near;
            dateTimeRangeClientRuler2.LabelPadding = new Padding(2, 8, 8, 8);
            dateTimeRangeClientRuler2.LabelVerticalAlignment = DateTimeRangeClientLabelVerticalAlignment.Bottom;
            dateTimeRangeClientRuler2.ShowInContentArea = true;
            dateTimeRangeClientRuler2.Type = DateTimeRangeClientMeasureType.Month;
            dateTimeRangeControlClient1.Rulers.Add(dateTimeRangeClientRuler1);
            dateTimeRangeControlClient1.Rulers.Add(dateTimeRangeClientRuler2);

            this.Controls.Add(rangeControl1);
            ((ISupportInitialize)(rangeControl1)).EndInit();
            this.ResumeLayout(false);
        }
    }
}

Run Demo

Inheritance

See Also