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

DataGrid fixes and updates #2545

Merged
merged 17 commits into from Oct 18, 2018
Merged

DataGrid fixes and updates #2545

merged 17 commits into from Oct 18, 2018

Conversation

@RBrid
Copy link
Contributor

@RBrid RBrid commented Oct 10, 2018

Issue:
#2478
#2472

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Code style update (formatting)
  • Refactoring (no functional changes, no api changes)

What is the current behavior?

  • SampleApp bug: Reversing sort direction was broken in DataGrid sample page.
  • DataGrid control bug: Layout cycle caused app crash.

What is the new behavior?

  • SampleApp fix: The page was hooking up to the DataGrid.Sorting event twice. As a result when clicking a column header, the sort was processed twice. The sort handler's logic for picking a new sort direction was wrong too, and the previousSortDirection variable was unnecessary.
  • Layout cycle fix: The use of DoubleUtil.AreClose was too restrictive. The code is now using a constant DATAGRID_roundingDelta which is identical to LayoutTransformControl's existing AcceptableDelta constant.
  • DataGridComboBoxColumn updates:
    • a bit of reformatting for consistency with other DataGrid files.
    • added a DataGrid.Columns.CollectionChanged handler to unhook events like the DataGridCheckBoxColumn already did.
    • moved exception strings into DataGridError.DataGridComboBoxColumn for consistency with existing DataGrid code.
  • DataGridTextColumn update:
    • removed use of Windows.ApplicationModel.DesignMode.DesignModeEnabled which we discovered was incorrect during the new DataGridComboBoxColumn testing. FrameworkElement.SetBinding should never be called with a Null binding.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Sample in sample app has been added / updated (for bug fixes / features)
  • 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)
  • Contains NO breaking changes

Other information

RBrid added 4 commits Oct 5, 2018
- Moving DataGridComboBoxColumn exceptions into DataGridError.cs.
- Unhooking LoadingRow/CellEditEnded handlers when DataGridComboBoxColumn is removed from columns collection.
- Fixing SampleApp's sorting logic to allow reversing sort direction.
RBrid and others added 5 commits Oct 11, 2018
@nmetulev nmetulev changed the title Harinikmsft/datagrid DataGrid fixes and updates Oct 15, 2018
? ItemsSource?.Cast<object>().FirstOrDefault(x => x.GetType().GetProperty(Binding.Path.Path).GetValue(x).Equals(value))
: ItemsSource?.Cast<object>().FirstOrDefault(x => x.Equals(value));
var selection = !string.IsNullOrEmpty(this.DisplayMemberPath)
? this.ItemsSource?.Cast<object>().FirstOrDefault(x => x.GetType().GetProperty(this.Binding.Path.Path).GetValue(x).Equals(value))

This comment has been minimized.

@nmetulev

nmetulev Oct 16, 2018
Contributor

per the C# coding guidelines we should avoid using this.

This comment has been minimized.

@nmetulev

nmetulev Oct 16, 2018
Contributor

@MSRegisB, could you update the PR to remove the this.?

Copy link
Contributor

@azchohfi azchohfi left a comment

Just remove the "this." and I'll approve it.

@RBrid
Copy link
Contributor Author

@RBrid RBrid commented Oct 17, 2018

Dropped the "this." in the combobox column. There are about 2950 instances left in the rest of the DataGrid code.

@azchohfi azchohfi merged commit 4fecf65 into master Oct 18, 2018
3 checks passed
3 checks passed
Toolkit-CI Build #5.0.0-build.104+ga8652b9f24 succeeded
Details
WIP ready for review
Details
license/cla All CLA requirements met.
Details
@delete-merged-branch delete-merged-branch bot deleted the harinikmsft/datagrid branch Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.