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

[CalendarDatePicker][WASM] Using a CalendarDatePicker in a DataGrid column doesn't commit selected date #6543

Closed
3 of 24 tasks
jsinsel-kahua opened this issue Jul 23, 2021 · 2 comments · Fixed by unoplatform/Uno.WindowsCommunityToolkit#153
Assignees
Labels
area/date-time-pickers DatePicker, TimePicker, CalendarDatePicker... difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...)

Comments

@jsinsel-kahua
Copy link

Current behavior

Set up a DataGrid with a DataGridTemplateColumn that has a CellEditingTemplate as a CalendarDatePicker. When the column is editing, you can open the calendar flyout. However, selecting a date will not commit the value to the cell's data item.

Expected behavior

The date selected in the calendar flyout would be applied to the data item.

How to reproduce it (as minimally and precisely as possible)

Attaching a sample project.
App1.Shared.zip

Workaround

Works on UWP/WinUI

No. Microsoft has a similar bug ticket, but the behavior is different. Their flyout immediately closes whereas Uno lets you pick a date.
CommunityToolkit/WindowsCommunityToolkit#2493

Environment

Nuget Package:

  • Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

Nuget Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

IDE:

  • Visual Studio 2017 (version: )
  • Visual Studio 2019 (version: )
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

@jsinsel-kahua jsinsel-kahua added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Jul 23, 2021
@jeromelaban jeromelaban added area/date-time-pickers DatePicker, TimePicker, CalendarDatePicker... project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...) and removed triage/untriaged Indicates an issue requires triaging or verification labels Jul 23, 2021
@lukeblevins
Copy link
Contributor

@jeromelaban Potential fix submitted upstream: CommunityToolkit/WindowsCommunityToolkit#4148

@jeromelaban
Copy link
Member

ghost pushed a commit to CommunityToolkit/WindowsCommunityToolkit that referenced this issue Sep 3, 2021
<!-- 🚨 Please Do Not skip any instructions and information mentioned below as they are all required and essential to evaluate and test the PR. By fulfilling all the required information you will be able to reduce the volume of questions and most likely help merge the PR faster 🚨 -->

<!-- 👉 It is imperative to resolve ONE ISSUE PER PR and avoid making multiple changes unless the changes interrelate with each other --> 

<!-- 📝 Please always keep the "☑️ Allow edits by maintainers" button checked in the Pull Request Template as it increases collaboration with the Toolkit maintainers by permitting commits to your PR branch (only) created from your fork. This can let us quickly make fixes for minor typos or forgotten StyleCop issues during review without needing to wait on you doing extra work. Let us help you help us! 🎉 -->

### Note: This is a copy of the previously reviewed work with a new branch name
## Fixes #2493
<!-- Add the relevant issue number after the "#" mentioned above (for ex: "## Fixes #1234") which will automatically close the issue once the PR is merged. -->

<!-- Add a brief overview here of the feature/bug & fix. -->
This prevents DataGrid from assuming focus should be reset back to itself when a control inside DataGridTemplateColumn gains focus. This is my first WCT PR, so please go easy on me 😆 
## PR Type
What kind of change does this PR introduce?
<!-- Please uncomment one or more options below that apply to this PR. -->
Bugfix 
<!-- - -->
<!-- - Feature -->
<!-- - Code style update (formatting) -->
<!-- - Refactoring (no functional changes, no api changes) -->
<!-- - Build or CI related changes -->
<!-- - Documentation content changes -->
<!-- - Sample app changes -->
<!-- - Other... Please describe: -->


## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
Trying to open a control like CalendarDatePicker from within a DataGridTemplateColumn doesn't work, as there is specific behavior to detect when DataGrid loses focus and return it. This doesn't make much sense for controls which require focus to function properly.

## What is the new behavior?
<!-- Describe how was this issue resolved or changed? -->
When the DataGrid loses focus, we now specifically detect if the editing column is a DataGridTemplateColumn and alter the behavior to accommodate this.

## PR Checklist

Please check if your PR fulfills the following requirements:

- [x] Tested code with current [supported SDKs](../readme.md#supported)
- [ ] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link -->
- [ ] Sample in sample app has been added / updated (for bug fixes / features)
    - [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/CommunityToolkit/WindowsCommunityToolkit-design-assets)
- [ ] New major technical changes in the toolkit have or will be added to the [Wiki](https://github.com/CommunityToolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
- [ ] Tests for the changes have been added (for bug fixes / features) (if applicable)
- [ ] Header has been added to all new source files (run *build/UpdateHeaders.bat*)
- [x] Contains **NO** breaking changes

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below.
     Please note that breaking changes are likely to be rejected within minor release cycles or held until major versions. -->


## Other information
I'm unsure if this is the *best* way to do this, but it makes the most sense given how DataGrid already has the capability to detect the editing element and column type.
Additional context before branch rename: #4206
Related: unoplatform/uno#6543
@jeromelaban jeromelaban reopened this Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/date-time-pickers DatePicker, TimePicker, CalendarDatePicker... difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants