fixed #913
This commit is contained in:
1 parent
8813fddfac
commit
a7b2d297a7
3 files changed
+31
-10
No files matched your search
@@ -367,9 +367,11 @@ namespace HandyControl.Controls
|
|||||||
_dropDownButton.Click += DropDownButton_Click;
|
_dropDownButton.Click += DropDownButton_Click;
|
||||||
_dropDownButton.MouseLeave += DropDownButton_MouseLeave;
|
_dropDownButton.MouseLeave += DropDownButton_MouseLeave;
|
||||||
|
|
||||||
|
var selectedDateTime = SelectedDateTime;
|
||||||
|
|
||||||
if (_textBox != null)
|
if (_textBox != null)
|
||||||
{
|
{
|
||||||
if (SelectedDateTime == null)
|
if (selectedDateTime == null)
|
||||||
{
|
{
|
||||||
_textBox.Text = DateTime.Now.ToString(DateTimeFormat);
|
_textBox.Text = DateTime.Now.ToString(DateTimeFormat);
|
||||||
}
|
}
|
||||||
@@ -385,7 +387,7 @@ namespace HandyControl.Controls
|
|||||||
_textBox.TextChanged += TextBox_TextChanged;
|
_textBox.TextChanged += TextBox_TextChanged;
|
||||||
_textBox.LostFocus += TextBox_LostFocus;
|
_textBox.LostFocus += TextBox_LostFocus;
|
||||||
|
|
||||||
if (SelectedDateTime == null)
|
if (selectedDateTime == null)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(_defaultText))
|
if (!string.IsNullOrEmpty(_defaultText))
|
||||||
{
|
{
|
||||||
@@ -395,12 +397,19 @@ namespace HandyControl.Controls
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_textBox.Text = DateTimeToString(SelectedDateTime.Value);
|
_textBox.Text = DateTimeToString(selectedDateTime.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_originalSelectedDateTime ??= DateTime.Now;
|
if (selectedDateTime is null)
|
||||||
SetCurrentValue(DisplayDateTimeProperty, _originalSelectedDateTime);
|
{
|
||||||
|
_originalSelectedDateTime ??= DateTime.Now;
|
||||||
|
SetCurrentValue(DisplayDateTimeProperty, _originalSelectedDateTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetCurrentValue(DisplayDateTimeProperty, selectedDateTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool VerifyData()
|
public virtual bool VerifyData()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
@@ -194,6 +195,7 @@ namespace HandyControl.Controls
|
|||||||
if (dp.SelectedTime.HasValue)
|
if (dp.SelectedTime.HasValue)
|
||||||
{
|
{
|
||||||
var time = dp.SelectedTime.Value;
|
var time = dp.SelectedTime.Value;
|
||||||
|
Trace.WriteLine(time);
|
||||||
dp.SetTextInternal(dp.DateTimeToString(time));
|
dp.SetTextInternal(dp.DateTimeToString(time));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,9 +464,11 @@ namespace HandyControl.Controls
|
|||||||
_dropDownButton.Click += DropDownButton_Click;
|
_dropDownButton.Click += DropDownButton_Click;
|
||||||
_dropDownButton.MouseLeave += DropDownButton_MouseLeave;
|
_dropDownButton.MouseLeave += DropDownButton_MouseLeave;
|
||||||
|
|
||||||
|
var selectedTime = SelectedTime;
|
||||||
|
|
||||||
if (_textBox != null)
|
if (_textBox != null)
|
||||||
{
|
{
|
||||||
if (SelectedTime == null)
|
if (selectedTime == null)
|
||||||
{
|
{
|
||||||
_textBox.Text = DateTime.Now.ToString(TimeFormat);
|
_textBox.Text = DateTime.Now.ToString(TimeFormat);
|
||||||
}
|
}
|
||||||
@@ -480,7 +484,7 @@ namespace HandyControl.Controls
|
|||||||
_textBox.TextChanged += TextBox_TextChanged;
|
_textBox.TextChanged += TextBox_TextChanged;
|
||||||
_textBox.LostFocus += TextBox_LostFocus;
|
_textBox.LostFocus += TextBox_LostFocus;
|
||||||
|
|
||||||
if (SelectedTime == null)
|
if (selectedTime == null)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(_defaultText))
|
if (!string.IsNullOrEmpty(_defaultText))
|
||||||
{
|
{
|
||||||
@@ -490,12 +494,19 @@ namespace HandyControl.Controls
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_textBox.Text = DateTimeToString((DateTime) SelectedTime);
|
_textBox.Text = DateTimeToString(selectedTime.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_originalSelectedTime ??= DateTime.Now;
|
if (selectedTime is null)
|
||||||
SetCurrentValue(DisplayTimeProperty, _originalSelectedTime);
|
{
|
||||||
|
_originalSelectedTime ??= DateTime.Now;
|
||||||
|
SetCurrentValue(DisplayTimeProperty, _originalSelectedTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetCurrentValue(DisplayTimeProperty, selectedTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() => SelectedTime?.ToString(TimeFormat) ?? string.Empty;
|
public override string ToString() => SelectedTime?.ToString(TimeFormat) ?? string.Empty;
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ namespace HandyControl.Controls
|
|||||||
var v = (DateTime) e.NewValue;
|
var v = (DateTime) e.NewValue;
|
||||||
ctl._clock.SelectedTime = v;
|
ctl._clock.SelectedTime = v;
|
||||||
ctl._calendar.SelectedDate = v;
|
ctl._calendar.SelectedDate = v;
|
||||||
|
ctl._calendar.DisplayDate = v;
|
||||||
ctl.OnDisplayDateTimeChanged(new FunctionEventArgs<DateTime>(v));
|
ctl.OnDisplayDateTimeChanged(new FunctionEventArgs<DateTime>(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user