mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-23 06:25:19 -07:00
Switching from Difference between dates to Add or subtract dates ignores the first date field (#1210)
This commit is contained in:
parent
56760794dd
commit
fd48f6ec1d
1 changed files with 21 additions and 1 deletions
|
@ -186,7 +186,27 @@ void DateCalculator::SetDefaultFocus()
|
||||||
void DateCalculator::DateCalcOption_Changed(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e)
|
void DateCalculator::DateCalcOption_Changed(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e)
|
||||||
{
|
{
|
||||||
FindName("AddSubtractDateGrid");
|
FindName("AddSubtractDateGrid");
|
||||||
DateCalculationOption->SelectionChanged -= m_dateCalcOptionChangedEventToken;
|
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||||
|
|
||||||
|
// From Date Field needs to persist across Date Difference and Add Substract Date Mode.
|
||||||
|
// So when the mode dropdown changes, update the other datepicker with the latest date.
|
||||||
|
if (dateCalcViewModel->IsDateDiffMode)
|
||||||
|
{
|
||||||
|
if (AddSubtract_FromDate->Date == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DateDiff_FromDate->Date = AddSubtract_FromDate->Date->Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DateDiff_FromDate->Date == nullptr)
|
||||||
|
{
|
||||||
|
// If no date has been picked, then this can be null.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AddSubtract_FromDate->Date = DateDiff_FromDate->Date->Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorApp::DateCalculator::AddSubtractDateGrid_Loaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e)
|
void CalculatorApp::DateCalculator::AddSubtractDateGrid_Loaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue