Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement more WinUI DatePickerHandler properties #859

Merged
merged 6 commits into from
May 26, 2021

Conversation

jsuarezruiz
Copy link
Contributor

@jsuarezruiz jsuarezruiz commented Apr 27, 2021

Description of Change

Implement more WinUI DatePickerHandler properties:

  • Format
  • MinimumDate
  • MaximumDate
  • CharacterSpacing
  • Font

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Does this PR touch anything that might effect accessibility?

No


nativeDatePicker.UpdateDay(datePicker);
nativeDatePicker.UpdateMonth(datePicker);
nativeDatePicker.UpdateYear(datePicker);
}

public static void UpdateDate(this DatePicker nativeDatePicker, DateTime dateTime)
{
nativeDatePicker.Date = new DateTimeOffset(new DateTime(dateTime.Ticks, DateTimeKind.Unspecified));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this handle the Format ?

@rmarinho
Copy link
Member

rmarinho commented May 7, 2021

Font and Format seem to be working, but max and min date seems something wrong..

new DatePicker { MinimumDate = DateTime.Now.AddDays(-1), Date = DateTime.Now, MaximumDate = DateTime.Now.AddDays(1) };

this still allows me to select days and months

image

@hartez
Copy link
Contributor

hartez commented May 26, 2021

Font and Format seem to be working, but max and min date seems something wrong..

new DatePicker { MinimumDate = DateTime.Now.AddDays(-1), Date = DateTime.Now, MaximumDate = DateTime.Now.AddDays(1) };

this still allows me to select days and months

This is a limitation of the WinUI DatePicker; it can only restrict the selectable years: https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.datepicker?view=winui-3.0#date-values

So the best we can do out of the box is set MinYear and MaxYear. Hopefully at some point we can include support for the CalendarDatePicker, where MinimumDate/MaximumDate is more useful.

@hartez hartez merged commit ca270b6 into main May 26, 2021
@hartez hartez deleted the winui-datepicker-moreproperties branch May 26, 2021 19:29
lytico pushed a commit to lytico/maui that referenced this pull request Jun 8, 2021
* Implement more properties in WinUI DatePickerHandler

* Mapped native DateChanged event

* Fix broken tests

* Enable nullable in WinUI DatePickerHandler

* Fix build error
@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2023
@samhouts samhouts added the fixed-in-6.0.100-preview.5 Look for this fix in 6.0.100-preview.5! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.100-preview.5 Look for this fix in 6.0.100-preview.5! platform/windows 🪟
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants