FuncUI
GitHub Repository
  • Getting Started
  • View Basics
    • Creating views
    • Lifetime
    • Attributes
    • How to create bindings
  • Components
    • Component basics
    • Component lifetime
    • Hooks
  • Common Questions
  • Controls
    • Button
    • Border
    • Calendar
    • CalendarDatePicker
    • CheckBox
    • DatePicker
    • DockPanel
    • Expander
    • ListBox
    • Menu
    • NativeMenu
    • NumericUpDown
    • ProgressBar
    • RadioButton
    • RepeatButton
    • Slider
    • StackPanel
    • Tabs
    • TextBlock
    • TextBox
    • TimePicker
    • ToggleButton
    • ToggleSwitch
Powered by GitBook
On this page
  1. Controls

DatePicker

Last updated 2 years ago

Note: You can check the Avalonia docs for the and if you need more information.

For Avalonia.FuncUI's DSL properties you can check

The DatePicker control is a single date picker that displays a calendar, it is also possible to enter a date via the TextBox the control has

Usage

Set Label

DatePicker.create [
  DatePicker.header "Title"
]

Set Date

DatePicker.create [
  DatePicker.selectedDate DateTime.Today
]

Set DateFormat

DatePicker.create [
  DatePicker.yearFormat "yyyy"
  DatePicker.monthFormat "MMMM"
  DatePicker.dayFormat "dd"
]

Limit Year Range

DatePicker.create [
  DatePicker.maxYear (DateTimeOffset(DateTime.Now))
]

Show Only Month and Year

You can control the visibility of the day, month, and year with similarly named functions.

DatePicker.create [
  DatePicker.dayVisible false
]

Register Selected Date

DatePicker.create [
  DatePicker.onSelectedDateChanged (fun dateOffset -> OnChangeDateOffset dateOffset |> dispatch)
]

You can check Microsoft docs for more information about the format strings.

You can check Microsoft docs for more information about setting time offsets.

DatePicker
DatePicker API
DatePicker.fs
Custom date and time format strings
DateTimeOffset