aardio 文档

DatePicker 日期选择框

AntdUI.DatePicker 用于选择日期,适合表单日期、筛选日期、到期日等场景。日期值是 .NET DateTime,常用显示格式为 yyyy-MM-dd

最小示例

import win.ui;
import dotNet.AntdUI;
/*DSG{{*/
var winform = win.form(text="AntdUI DatePicker";right=520;bottom=260)
winform.add(
host={cls="custom";left=40;top=40;right=300;bottom=80;edge=1;z=1}
)
/*}}*/

var picker = AntdUI.DatePicker(winform.host);
picker.Format = "yyyy-MM-dd";
picker.PlaceholderText = "请选择日期";
picker.AllowClear = true;
picker.DropDownArrow = true;

picker.ValueChanged = function(sender,e){
    winform.text = "日期已改变";
}

winform.show();
win.loopMessage();

常用属性

设置当前日期

import System;

picker.Value = System.DateTime.Now;

主动设置与清空

import System;

picker.Value = System.DateTime(2026,7,8);
picker.Clear();

ValueChanged 在日期改变时触发;ClearClick 可响应用户点击清除按钮;ExpandDropChanged 可监听下拉面板展开/关闭。

注意事项

Markdown 格式