本文整理汇总了C#中System.Windows.Controls.DatePicker类的典型用法代码示例。如果您正苦于以下问题:C# DatePicker类的具体用法?C# DatePicker怎么用?C# DatePicker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatePicker类属于System.Windows.Controls命名空间,在下文中一共展示了DatePicker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: YearPicker
public YearPicker()
{
InitializeComponent();
this.SelectedYearChanged += default_SelectedYearChanged;
datePicker = year_picker;
year_picker.CalendarOpened += DatePicker_CalendarOpened;
}
示例2: DateRangePanel
/// <summary>
/// Definiert das DateRangePanel
/// </summary>
/// <param name="dateFromProcessingFunction">Funktion, die vom Start-DatePicker bei Änderung aufgerufen wird</param>
/// <param name="dateToProcessingFunction">Funktion, die vom Ende-DatePicker bei Änderung aufgerufen wird</param>
/// <param name="datePickerFrom">Referenz zum darzustellenden DatePicker für Start</param>
/// <param name="datePickerTo">Referenz zum darzustellenden DatePicker für Ende</param>
public DateRangePanel(Action<DateTime> dateFromProcessingFunction, Action<DateTime> dateToProcessingFunction, ref DatePicker datePickerFrom, ref DatePicker datePickerTo)
{
this.dateFromProcessingFunction = dateFromProcessingFunction;
this.dateToProcessingFunction = dateToProcessingFunction;
this.datePickerFrom = datePickerFrom;
this.datePickerTo = datePickerTo;
Label lbFrom = new Label();
Label lbTo = new Label();
lbFrom.Content = IniParser.GetSetting("APPSETTINGS", "dateRangeFrom");
lbTo.Content = IniParser.GetSetting("APPSETTINGS", "dateRangeTo");
lbTo.Margin = new Thickness(10, 0, 0, 0);
this.datePickerFrom.Width = 95;
this.datePickerTo.Width = 95;
this.datePickerFrom.SelectedDate = BookingsHelper.getDateOfLastCashClosure();
this.datePickerTo.SelectedDate = DateTime.Today;
this.datePickerFrom.SelectedDateChanged += processDateFrom;
this.datePickerTo.SelectedDateChanged += processDateTo;
panel = new WrapPanel();
panel.HorizontalAlignment = HorizontalAlignment.Right;
panel.VerticalAlignment = VerticalAlignment.Top;
panel.Margin = new Thickness(30, 10, 20, 0); // links nur 30px wegen Platzmangel in Toolbar von Modul pSums
panel.Children.Add(lbFrom);
panel.Children.Add(this.datePickerFrom);
panel.Children.Add(lbTo);
panel.Children.Add(this.datePickerTo);
}
示例3: buttonCreat_Click
private void buttonCreat_Click(object sender, RoutedEventArgs e)
{
try
{
PassengerName name = new PassengerName();
name.Name = textBoxData1.Text;
DatePicker date = new DatePicker();
date.SelectedDate = DatePicker1.SelectedDate;
date.DisplayDateStart = new DateTime(2 / 8 / 16);
date.DisplayDateEnd = new DateTime(2 / 29 / 19);
date.IsTodayHighlighted = true;
filewritter1 filewriter = new filewritter1();
string PassengerInfo = null;
if (radioMke.IsChecked == true)
{
PassengerInfo = (Environment.NewLine + this.textBoxData1.Text + " is leaving on " + this.DatePicker1 + " and the flight Origin and Destination is " + this.radioMke.Content);
}
else if (radioTpa.IsChecked == true)
{
PassengerInfo = (Environment.NewLine + textBoxData1.Text + " is leaving on " + this.DatePicker1 + " and the flight Origin and Destination is " + this.radioTpa.Content);
}
filewriter.Print(PassengerInfo, "Manifest.txt");
//this.Close();
MessageBox.Show(PassengerInfo);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例4: GenerateEditingElement
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
DatePicker picker = new DatePicker();
picker.SetBinding(DatePicker.SelectedDateProperty, this.Binding);
picker.IsDropDownOpen = true;
return picker;
}
示例5: DateTimeEditor
public DateTimeEditor(WorkFrame frame)
: base(frame)
{
StackPanel panel = new StackPanel();
panel.Orientation = Orientation.Horizontal;
time = new TextBox();
time.DataContext = this;
time.Width = 64;
var timeBinding = new Binding("Value");
timeBinding.Mode = BindingMode.TwoWay;
timeBinding.Converter = this;
time.SetBinding(TextBox.TextProperty, timeBinding);
date = new DatePicker();
date.DataContext = this;
var dateBinding = new Binding("Value");
dateBinding.Converter = new DateConvert(time);
dateBinding.Mode = BindingMode.TwoWay;
date.SetBinding(DatePicker.SelectedDateProperty, dateBinding);
Button now = new Button();
now.Content = "当前时间";
now.Click += (s, e) => Value = DateTime.Now;
panel.Children.Add(date);
panel.Children.Add(time);
panel.Children.Add(now);
Content = panel;
}
示例6: DocUIDate
/// <summary>
/// Creates a new instance of the TimeOption
/// </summary>
/// <param name="xmlNode">The xmlnode containing the data.</param>
/// <param name="xsdNode">The corresponding xsdnode.</param>
/// <param name="panel">The panel on which this option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUIDate(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
Control = new DatePicker(); //{ Form Format = TimeFormat.Custom, FormatString = "HH:mm:ss" };
//(Control as DatePicker).ValueChanged += (s, e) => { hasPendingChanges(); };
setup();
}
示例7: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
DatePicker = (DatePicker)GetTemplateChild("PART_DatePicker");
DatePicker.SetBinding(DatePicker.SelectedDateProperty, new Binding { Source = this, Path = new PropertyPath(CurrentValueProperty), Mode = BindingMode.TwoWay });
DatePicker.SelectedDateChanged += DatePicker_SelectedDateChanged;
}
示例8: CreateView
public FrameworkElement CreateView(PropertyInfo property)
{
var inputControl = new DatePicker();
var binding = new Binding(property.Name);
binding.Mode = BindingMode.TwoWay;
inputControl.SetBinding(DatePicker.SelectedDateProperty, binding);
return inputControl;
}
示例9: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/ISEstimate;component/ISDate.xaml", System.UriKind.Relative));
this.dtpDate = ((System.Windows.Controls.DatePicker)(this.FindName("dtpDate")));
this.btnOK = ((System.Windows.Controls.Button)(this.FindName("btnOK")));
}
示例10: SetUpEndPicker
private void SetUpEndPicker()
{
_endDatePicker = new DatePicker();
_endDatePicker.Width = this.Width * 0.5;
_endDatePicker.Height = this.Height * 0.05;
_endDatePicker.FontSize = 20;
_endDatePicker.SelectedDateChanged += _endDatePicker_SelectedDateChanged;
}
示例11: GenerateElement
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
var element = new DatePicker
{
Style = Application.Current.Resources["DatePickerStyle"] as Style
};
element.SetBinding(DatePicker.SelectedDateProperty, Binding);
return element;
}
示例12: GenerateEditingElement
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
DatePicker picker = new DatePicker();
picker.MinHeight = 16;
picker.Padding = new Thickness(0);
picker.BorderThickness = new Thickness(0);
picker.SetBinding(DatePicker.SelectedDateProperty, Binding);
picker.IsDropDownOpen = true;
return picker;
}
示例13: DonorForm
public DonorForm()
{
InitializeComponent();
CurrentDonor = new Donor();
// Объявляем текущий контект для Binding.
donorInfoGrid.DataContext = CurrentDonor;
DatePicker a = new DatePicker();
}
示例14: IsEmpty
public static bool IsEmpty(DatePicker[] datePicker)
{
foreach (var item in datePicker)
{
if (item.Text.Length <= 0 || string.IsNullOrEmpty(item.Text))
{
return false;
}
}
return true;
}
示例15: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/%E5%A5%A5%E6%9E%AB%E7%87%83%E6%B0%94%E8%90%A5%E6%94%B6%E7%B3%BB%E7%BB%9FV3;compo" +
"nent/Program/ObjectTools/DateTimePicker.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.DatePicker = ((System.Windows.Controls.DatePicker)(this.FindName("DatePicker")));
this.TimePicker = ((System.Windows.Controls.TimePicker)(this.FindName("TimePicker")));
}