maui
maui copied to clipboard
Update mappers instead of replacing field values
Description of Change
Update mappers instead of replacing field values to prevent field/type reference ordering to influence the way mappers are set.
Currently we assume that UseMauiApp is the first part of MAUI that updates the mappers, however we can directly influence that very easily:
// load Core mappers
ElementHandler.ElementMapper.GetKeys();
ViewHandler.ViewMapper.GetKeys();
ButtonHandler.Mapper.GetKeys();
// then load Controls mappers
Button.ControlsButtonMapper.GetKeys();
Element.ControlsElementMapper.GetKeys();
VisualElement.ControlsVisualElementMapper.GetKeys();
By first forcing all the Core types to load, the Controls mappers are not correctly set up to handle changes later on. Because we first load Button.ControlsButtonMapper and then Element.ControlsElementMapper, the properties in Element are not available to Button.
This PR removes the need for ordering and makes sure that Button is chained to Element so we can ADD to Element and Button automatically gets the new properties.
Context: https://github.com/dotnet/maui/issues/11662#issuecomment-1464361623
Issues Fixed
Fixes #11662
Tasks
- [ ] Code
- [ ] Application.RemapForControls();
- [ ] VisualElement.RemapForControls();
- [ ] Label.RemapForControls();
- [ ] Button.RemapForControls();
- [ ] CheckBox.RemapForControls();
- [ ] DatePicker.RemapForControls();
- [ ] RadioButton.RemapForControls();
- [ ] FlyoutPage.RemapForControls();
- [ ] Toolbar.RemapForControls();
- [ ] Window.RemapForControls();
- [ ] Editor.RemapForControls();
- [ ] Entry.RemapForControls();
- [ ] Picker.RemapForControls();
- [ ] SearchBar.RemapForControls();
- [ ] TabbedPage.RemapForControls();
- [ ] TimePicker.RemapForControls();
- [ ] Layout.RemapForControls();
- [ ] ScrollView.RemapForControls();
- [ ] RefreshView.RemapForControls();
- [ ] Shape.RemapForControls();
- [ ] WebView.RemapForControls();
- [ ] Tests
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.
🚨 API change(s) detected @davidbritch FYI
/rebase
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.
Just the one flyout header not collapsing test that passes locally... CI hates it for some reason. Not sure if some event is not firing or there is now a longer delay. But it passes locally. Almost impossible to debug.
Might need to add some screenshots.
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.
I will start mapper docs here: https://github.com/dotnet/maui/pull/16296
Still need to figure out the best way...
🧑🤝🧑