fix: fix some status logic.
This commit is contained in:
@@ -76,7 +76,7 @@ public class CalendarDayButton : ContentControl
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_isStartDate = value;
|
_isStartDate = value;
|
||||||
SetPseudoClass(PC_StartDate);
|
SetPseudoClass(PC_StartDate, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class CalendarDayButton : ContentControl
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_isEndDate = value;
|
_isEndDate = value;
|
||||||
SetPseudoClass(PC_EndDate);
|
SetPseudoClass(PC_EndDate, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class CalendarDayButton : ContentControl
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_isPreviewStartDate = value;
|
_isPreviewStartDate = value;
|
||||||
PseudoClasses.Set(PC_PreviewStartDate, value);
|
SetPseudoClass(PC_PreviewStartDate, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ public class CalendarDayButton : ContentControl
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_isPreviewEndDate = value;
|
_isPreviewEndDate = value;
|
||||||
PseudoClasses.Set(PC_PreviewEndDate, value);
|
SetPseudoClass(PC_PreviewEndDate, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ public class CalendarDayButton : ContentControl
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_isInRange = value;
|
_isInRange = value;
|
||||||
PseudoClasses.Set(PC_InRange, value);
|
SetPseudoClass(PC_InRange, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ public class CalendarDayButton : ContentControl
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_isSelected = value;
|
_isSelected = value;
|
||||||
SetPseudoClass(PseudoClassName.PC_Selected);
|
SetPseudoClass(PseudoClassName.PC_Selected, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,15 +191,15 @@ public class CalendarDayButton : ContentControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetPseudoClass(string s)
|
private void SetPseudoClass(string s, bool value)
|
||||||
{
|
{
|
||||||
if (_pseudoClasses.Contains(s))
|
if (_pseudoClasses.Contains(s) && value)
|
||||||
{
|
{
|
||||||
foreach (var pc in _pseudoClasses)
|
foreach (var pc in _pseudoClasses)
|
||||||
{
|
{
|
||||||
PseudoClasses.Set(pc, false);
|
PseudoClasses.Set(pc, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PseudoClasses.Set(s, true);
|
PseudoClasses.Set(s, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -553,20 +553,37 @@ public class CalendarView : TemplatedControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearSelection()
|
public void ClearSelection(bool start = true, bool end = true)
|
||||||
{
|
{
|
||||||
_start = null;
|
if (start)
|
||||||
_end = null;
|
{
|
||||||
_previewStart = null;
|
_previewStart = null;
|
||||||
_previewEnd = null;
|
_start = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end)
|
||||||
|
{
|
||||||
|
_previewEnd = null;
|
||||||
|
_end = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (_monthGrid?.Children is null) return;
|
if (_monthGrid?.Children is null) return;
|
||||||
foreach (var child in _monthGrid.Children)
|
foreach (var child in _monthGrid.Children)
|
||||||
{
|
{
|
||||||
if (child is not CalendarDayButton button) continue;
|
if (child is not CalendarDayButton button) continue;
|
||||||
button.IsStartDate = false;
|
if (start)
|
||||||
button.IsEndDate = false;
|
{
|
||||||
button.IsInRange = false;
|
button.IsPreviewStartDate = false;
|
||||||
|
button.IsStartDate = false;
|
||||||
|
}
|
||||||
|
if (end)
|
||||||
|
{
|
||||||
|
button.IsEndDate = false;
|
||||||
|
button.IsInRange = false;
|
||||||
|
}
|
||||||
|
button.IsPreviewEndDate = false;
|
||||||
}
|
}
|
||||||
|
UpdateDayButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPointerExited(PointerEventArgs e)
|
protected override void OnPointerExited(PointerEventArgs e)
|
||||||
|
|||||||
@@ -302,8 +302,8 @@ public class DateRangePicker : DatePickerBase
|
|||||||
if (string.IsNullOrEmpty(textBox?.Text))
|
if (string.IsNullOrEmpty(textBox?.Text))
|
||||||
{
|
{
|
||||||
SetCurrentValue(property, null);
|
SetCurrentValue(property, null);
|
||||||
_startCalendar?.ClearSelection();
|
_startCalendar?.ClearSelection(start: true);
|
||||||
_endCalendar?.ClearSelection();
|
_endCalendar?.ClearSelection(end: true);
|
||||||
}
|
}
|
||||||
else if (DisplayFormat is null || DisplayFormat.Length == 0)
|
else if (DisplayFormat is null || DisplayFormat.Length == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user