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

Update mappers instead of replacing field values #13836

Merged
merged 127 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from 123 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
2ce285c
Fix InputTransparent and CascadeInputTransparent
mattleibow Apr 29, 2023
1895907
Adding some tests for the baseline
mattleibow Apr 29, 2023
86bf05d
Merge branch 'dev/input-transparent' into dev/input-transparency
mattleibow Apr 29, 2023
802dc6e
This works better
mattleibow Apr 30, 2023
063147c
Fix this
mattleibow May 1, 2023
77de113
Also these platforms
mattleibow May 1, 2023
1224014
Support compatibility
mattleibow May 1, 2023
36691d5
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 1, 2023
172a95e
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 2, 2023
61fa09f
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 2, 2023
36aca2b
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 2, 2023
c69dabd
Improved the sample for testing
mattleibow May 2, 2023
454de2f
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 3, 2023
f83b9f8
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 4, 2023
9609697
See what this does
mattleibow May 4, 2023
38213d6
Revert "See what this does"
mattleibow May 4, 2023
d695531
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 5, 2023
e5ac916
comment out new tests
mattleibow May 5, 2023
27366b9
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 9, 2023
31bfb34
Try reverting these
mattleibow May 9, 2023
c7887a7
Revert "Try reverting these"
mattleibow May 9, 2023
5a6b8f0
Revert the bad code hacks
mattleibow May 9, 2023
944f048
This should work!
mattleibow May 10, 2023
c1705c6
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 10, 2023
c9c218f
Use AppendToMapping for Focus commands
mattleibow May 11, 2023
d5730f7
Use new PrependToMapping method
mattleibow May 11, 2023
792bf74
this
mattleibow May 11, 2023
41fac60
The entire method is replaced
mattleibow May 12, 2023
d24dd47
Use AppendToMapping for Element and VisualElement
mattleibow May 12, 2023
8572262
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 12, 2023
bb9adac
Skip the failing test for now
mattleibow May 12, 2023
572a2a4
this is no longer needed
mattleibow May 12, 2023
51da889
yaml
mattleibow May 12, 2023
b7b1b3a
this
mattleibow May 12, 2023
9e9eb32
Revert "yaml"
mattleibow May 12, 2023
c994738
Revert "this"
mattleibow May 12, 2023
4395818
this
mattleibow May 12, 2023
8e4d8f0
Move some controls to use ModifyMapping
mattleibow May 12, 2023
ca415aa
Added a test
mattleibow May 16, 2023
aac5366
Merge remote-tracking branch 'origin/main' into dev/window-title
mattleibow May 16, 2023
89ce5d6
Ensure iOS "text boxes" preserve cursor location
mattleibow May 16, 2023
4426c52
Fix the Windows tests
mattleibow May 16, 2023
8ca70af
Attach the controls to the UI for focus tests
mattleibow May 16, 2023
8c4c9c6
undo this
mattleibow May 16, 2023
d1dae3f
Merge remote-tracking branch 'origin/main' into dev/focus
mattleibow May 16, 2023
345fb04
and this
mattleibow May 16, 2023
a6c5cde
Merge remote-tracking branch 'origin/main' into dev/more-mappers
mattleibow May 16, 2023
ef22aad
obsolete for now
mattleibow May 16, 2023
2ec1b72
not Element yet
mattleibow May 16, 2023
30e20c7
Adding some more "text box" tests
mattleibow May 16, 2023
328c6ba
todo
mattleibow May 16, 2023
8564d88
Merge branch 'dev/testbox-tests' into dev/ios-text
mattleibow May 16, 2023
163b83f
tests
mattleibow May 16, 2023
6065a41
Revert "todo"
mattleibow May 16, 2023
d62b12a
this
mattleibow May 16, 2023
6194a71
move
mattleibow May 16, 2023
2ed2527
Revert "this"
mattleibow May 17, 2023
b093d39
moar tests
mattleibow May 17, 2023
6f62aff
Revert "Revert "todo""
mattleibow May 17, 2023
740f67d
all working on windows
mattleibow May 17, 2023
1b412a4
Merge branch 'dev/ios-text' into dev/more-mappers
mattleibow May 18, 2023
86774a6
Merge branch 'dev/focus' into dev/more-mappers
mattleibow May 18, 2023
0622a7d
Merge branch 'dev/window-title' into dev/more-mappers
mattleibow May 18, 2023
045457b
build all again
mattleibow May 18, 2023
3e0fa49
Merge remote-tracking branch 'origin/main' into dev/ios-text
mattleibow May 26, 2023
b59d0b7
Merge the methods
mattleibow May 26, 2023
d9efbd3
Merge remote-tracking branch 'origin/main' into dev/ios-text
mattleibow May 26, 2023
d797992
Merge remote-tracking branch 'origin/main' into dev/ios-text
mattleibow May 30, 2023
077f2ba
Merge branch 'dev/ios-text' into dev/more-mappers
mattleibow May 30, 2023
2ed88fe
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow May 30, 2023
26bcea2
Ensure iOS "text boxes" preserve cursor location
mattleibow May 16, 2023
b38a0d6
Fix the Windows tests
mattleibow May 16, 2023
8dc936b
Attach the controls to the UI for focus tests
mattleibow May 16, 2023
4a2f911
Adding some more "text box" tests
mattleibow May 16, 2023
5e870ad
todo
mattleibow May 16, 2023
7cdc2f8
tests
mattleibow May 16, 2023
e3a4747
Revert "todo"
mattleibow May 16, 2023
70bc6c0
this
mattleibow May 16, 2023
68dc760
move
mattleibow May 16, 2023
c93b474
Revert "this"
mattleibow May 17, 2023
9829831
moar tests
mattleibow May 17, 2023
7e4605e
Revert "Revert "todo""
mattleibow May 17, 2023
3257130
all working on windows
mattleibow May 17, 2023
4192bd5
Merge the methods
mattleibow May 26, 2023
a2730d1
Merge remote-tracking branch 'origin/main' into dev/ios-text
mattleibow Jun 7, 2023
5cdd77f
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow Jun 13, 2023
19eb385
Merge branch 'random' into dev/input-transparency
mattleibow Jun 27, 2023
9db3e96
Merge branch 'random3' into dev/input-transparency
mattleibow Jun 27, 2023
2fde244
Merge branch 'rand4' into dev/input-transparency
mattleibow Jun 27, 2023
41226bb
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow Jun 27, 2023
5634de3
removed as it is not needed
mattleibow Jun 27, 2023
21ce0d3
Merge remote-tracking branch 'origin/main' into dev/ios-text
mattleibow Jun 27, 2023
6f66935
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow Jun 27, 2023
038bcd8
Merge branch 'dev/input-transparency' into dev/berfore-mappers
mattleibow Jun 27, 2023
84fa903
Merge branch 'dev/berfore-mappers' into dev/more-mappers
mattleibow Jun 27, 2023
8f2db88
merge
mattleibow Jun 27, 2023
b3c4cf6
Merge remote-tracking branch 'origin/main' into dev/input-transparency
mattleibow Jun 29, 2023
260255f
Update src/Controls/tests/DeviceTests/ControlsHandlerTestBase.cs
mattleibow Jul 5, 2023
2e578a8
fix the variable names
mattleibow Jul 5, 2023
1868019
fix
mattleibow Jul 5, 2023
e9d4467
Merge branch 'dev/ios-text' into dev/more-mappers
mattleibow Jul 5, 2023
3be455a
Merge branch 'dev/input-transparency' into dev/more-mappers
mattleibow Jul 5, 2023
949fd13
Merge branch 'main' into dev/more-mappers
mattleibow Jul 10, 2023
69096dd
Merge branch 'dev/more-mappers' into dev/update-mappers
mattleibow Jul 10, 2023
323fb6f
reset
mattleibow Jul 10, 2023
0f9546f
Merge remote-tracking branch 'origin/main' into dev/more-mappers
mattleibow Jul 10, 2023
35f3db0
Fix things a bit more
mattleibow Jul 10, 2023
eeb5563
Improve test reports
mattleibow Jul 10, 2023
b312e3a
fix things
mattleibow Jul 10, 2023
ff6c31b
Merge remote-tracking branch 'origin/main' into dev/more-mappers
mattleibow Jul 20, 2023
aaf05c1
Merge branch 'main' into dev/more-mappers
mattleibow Jul 21, 2023
52b24cd
Update Layout.Standard.cs
mattleibow Jul 21, 2023
db9e3a7
Update Layout.Standard.cs
mattleibow Jul 21, 2023
405ce17
Merge branch 'dev/more-mappers' into dev/update-mappers
mattleibow Jul 21, 2023
dd30e5d
not needed
mattleibow Jul 21, 2023
efcf1d4
Merge branch 'main' into dev/more-mappers
mattleibow Jul 21, 2023
4d102e5
Merge branch 'dev/more-mappers' into dev/fix-mapper-field-ordering
mattleibow Jul 21, 2023
f82bf2a
ReplaceMapping
mattleibow Jul 21, 2023
1693c66
Merge branch 'dev/more-mappers' into dev/fix-mapper-field-ordering
mattleibow Jul 21, 2023
53b558e
updates
mattleibow Jul 21, 2023
d062efa
Fix the mappers
mattleibow Jul 21, 2023
3b4c9ad
this
mattleibow Jul 21, 2023
32edc6a
Merge branch 'dev/more-mappers' into dev/fix-mapper-field-ordering
mattleibow Jul 21, 2023
053c6d3
Update AppHostBuilderExtensions.cs
mattleibow Jul 21, 2023
f59c527
Merge remote-tracking branch 'origin/dev/more-mappers' into dev/fix-m…
mattleibow Jul 21, 2023
0eaffa7
ws
mattleibow Jul 21, 2023
43bc034
Merge branch 'dev/more-mappers' into dev/fix-mapper-field-ordering
mattleibow Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Controls/src/Core/Application/Application.Mapper.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#nullable disable
using System;

namespace Microsoft.Maui.Controls
{
public partial class Application
{
[Obsolete("Use ApplicationHandler.Mapper instead.")]
public static IPropertyMapper<IApplication, ApplicationHandler> ControlsApplicationMapper =
new PropertyMapper<Application, ApplicationHandler>(ApplicationHandler.Mapper)
{
#if ANDROID
// There is also a mapper on Window for this property since this property is relevant at the window level for
// Android not the application level
[PlatformConfiguration.AndroidSpecific.Application.WindowSoftInputModeAdjustProperty.PropertyName] = MapWindowSoftInputModeAdjust,
#endif
};
new PropertyMapper<Application, ApplicationHandler>(ApplicationHandler.Mapper);

internal static void RemapForControls()
internal static new void RemapForControls()
{
// Adjust the mappings to preserve Controls.Application legacy behaviors
ApplicationHandler.Mapper = ControlsApplicationMapper;
#if ANDROID
// There is also a mapper on Window for this property since this property is relevant at the window level for
// Android not the application level
ApplicationHandler.Mapper.ReplaceMapping<Application, ApplicationHandler>(PlatformConfiguration.AndroidSpecific.Application.WindowSoftInputModeAdjustProperty.PropertyName, MapWindowSoftInputModeAdjust);
#endif
}
}
}
22 changes: 10 additions & 12 deletions src/Controls/src/Core/Button/Button.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,22 @@ public partial class Button
/// <summary>
/// The property mapper that maps the abstract properties to the platform-specific methods for further processing.
/// </summary>
public static IPropertyMapper<IButton, ButtonHandler> ControlsButtonMapper = new PropertyMapper<Button, ButtonHandler>(ButtonHandler.Mapper)
[Obsolete("Use ButtonHandler.Mapper instead.")]
public static IPropertyMapper<IButton, ButtonHandler> ControlsButtonMapper = new PropertyMapper<Button, ButtonHandler>(ButtonHandler.Mapper);

internal new static void RemapForControls()
{
[nameof(ContentLayout)] = MapContentLayout,
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(ContentLayout), MapContentLayout);
#if IOS
[nameof(Padding)] = MapPadding,
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(Padding), MapPadding);
#endif
#if WINDOWS
[nameof(IText.Text)] = MapText,
[nameof(ImageSource)] = MapImageSource,
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(ImageSource), MapImageSource);
#endif
[nameof(TextTransform)] = MapText,
[nameof(Text)] = MapText,
[nameof(Button.LineBreakMode)] = MapLineBreakMode,
};
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(Text), MapText);

internal new static void RemapForControls()
{
ButtonHandler.Mapper = ControlsButtonMapper;
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(TextTransform), MapText);
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(Button.LineBreakMode), MapLineBreakMode);
}

/// <summary>
Expand Down
14 changes: 5 additions & 9 deletions src/Controls/src/Core/CheckBox/CheckBox.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ namespace Microsoft.Maui.Controls
{
public partial class CheckBox
{
// TODO Make public for NET8
internal static IPropertyMapper<ICheckBox, CheckBoxHandler> ControlsCheckBoxMapper = new PropertyMapper<CheckBox, CheckBoxHandler>(CheckBoxHandler.Mapper)
internal new static void RemapForControls()
{
[nameof(Color)] = (handler, view) =>
{
handler?.UpdateValue(nameof(ICheckBox.Foreground));
}
};
CheckBoxHandler.Mapper.ReplaceMapping<ICheckBox, ICheckBoxHandler>(nameof(Color), MapColor);
}

internal new static void RemapForControls()
internal static void MapColor(ICheckBoxHandler handler, ICheckBox view)
{
CheckBoxHandler.Mapper = ControlsCheckBoxMapper;
handler?.UpdateValue(nameof(ICheckBox.Foreground));
}
}
}
14 changes: 7 additions & 7 deletions src/Controls/src/Core/DatePicker/DatePicker.Mapper.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#nullable disable
using System;

namespace Microsoft.Maui.Controls
{
public partial class DatePicker
{
public static IPropertyMapper<IDatePicker, DatePickerHandler> ControlsDatePickerMapper = new PropertyMapper<DatePicker, DatePickerHandler>(DatePickerHandler.Mapper)
{
#if IOS
[PlatformConfiguration.iOSSpecific.DatePicker.UpdateModeProperty.PropertyName] = MapUpdateMode,
#endif
};
[Obsolete("Use DatePickerHandler.Mapper instead.")]
public static IPropertyMapper<IDatePicker, DatePickerHandler> ControlsDatePickerMapper = new PropertyMapper<DatePicker, DatePickerHandler>(DatePickerHandler.Mapper);

internal static new void RemapForControls()
{
// Adjust the mappings to preserve Controls.DatePicker legacy behaviors
DatePickerHandler.Mapper = ControlsDatePickerMapper;
#if IOS
DatePickerHandler.Mapper.ReplaceMapping<DatePicker, IDatePickerHandler>(PlatformConfiguration.iOSSpecific.DatePicker.UpdateModeProperty.PropertyName, MapUpdateMode);
#endif
}
}
}
12 changes: 5 additions & 7 deletions src/Controls/src/Core/Editor/Editor.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ namespace Microsoft.Maui.Controls
{
public partial class Editor
{
public static void MapText(EditorHandler handler, Editor editor)
public static void MapText(EditorHandler handler, Editor editor) =>
MapText((IEditorHandler)handler, editor);

public static void MapText(IEditorHandler handler, Editor editor)
{
if (handler.DataFlowDirection == DataFlowDirection.FromPlatform)
if (handler is ViewHandler viewHandler && viewHandler.DataFlowDirection == DataFlowDirection.FromPlatform)
{
Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, editor);
return;
}

MapText((IEditorHandler)handler, editor);
}

public static void MapText(IEditorHandler handler, Editor editor)
{
Platform.EditTextExtensions.UpdateText(handler.PlatformView, editor);
}

Expand Down
18 changes: 9 additions & 9 deletions src/Controls/src/Core/Editor/Editor.Mapper.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#nullable disable
using System;

namespace Microsoft.Maui.Controls
{
public partial class Editor
{
[Obsolete("Use EditorHandler.Mapper instead.")]
public static IPropertyMapper<IEditor, EditorHandler> ControlsEditorMapper =
new PropertyMapper<Editor, EditorHandler>(EditorHandler.Mapper)
{
#if WINDOWS
[PlatformConfiguration.WindowsSpecific.InputView.DetectReadingOrderFromContentProperty.PropertyName] = MapDetectReadingOrderFromContent,
#endif
[nameof(Text)] = MapText,
[nameof(TextTransform)] = MapText,
};
new PropertyMapper<Editor, EditorHandler>(EditorHandler.Mapper);

internal static new void RemapForControls()
{
// Adjust the mappings to preserve Controls.Editor legacy behaviors
EditorHandler.Mapper = ControlsEditorMapper;
#if WINDOWS
EditorHandler.Mapper.ReplaceMapping<Editor, IEditorHandler>(PlatformConfiguration.WindowsSpecific.InputView.DetectReadingOrderFromContentProperty.PropertyName, MapDetectReadingOrderFromContent);
#endif
EditorHandler.Mapper.ReplaceMapping<Editor, IEditorHandler>(nameof(Text), MapText);
EditorHandler.Mapper.ReplaceMapping<Editor, IEditorHandler>(nameof(TextTransform), MapText);

#if ANDROID
EditorHandler.CommandMapper.PrependToMapping(nameof(IEditor.Focus), MapFocus);
Expand Down
11 changes: 7 additions & 4 deletions src/Controls/src/Core/Element/Element.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ namespace Microsoft.Maui.Controls
/// <include file="../../../docs/Microsoft.Maui.Controls/Element.xml" path="Type[@FullName='Microsoft.Maui.Controls.Element']/Docs/*" />
public partial class Element
{
public static IPropertyMapper<Maui.IElement, IElementHandler> ControlsElementMapper = new PropertyMapper<IElement, IElementHandler>(ViewHandler.ViewMapper)
[Obsolete("Use ViewHandler.ViewMapper instead.")]
public static IPropertyMapper<Maui.IElement, IElementHandler> ControlsElementMapper = new PropertyMapper<IElement, IElementHandler>(ViewHandler.ViewMapper);

internal static void RemapForControls()
{
[AutomationProperties.IsInAccessibleTreeProperty.PropertyName] = MapAutomationPropertiesIsInAccessibleTree,
[AutomationProperties.ExcludedWithChildrenProperty.PropertyName] = MapAutomationPropertiesExcludedWithChildren,
};
ViewHandler.ViewMapper.ReplaceMapping<Maui.IElement, IElementHandler>(AutomationProperties.IsInAccessibleTreeProperty.PropertyName, MapAutomationPropertiesIsInAccessibleTree);
ViewHandler.ViewMapper.ReplaceMapping<Maui.IElement, IElementHandler>(AutomationProperties.ExcludedWithChildrenProperty.PropertyName, MapAutomationPropertiesExcludedWithChildren);
}
}
}
16 changes: 7 additions & 9 deletions src/Controls/src/Core/Entry/Entry.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,8 @@ public partial class Entry
public static void MapImeOptions(EntryHandler handler, Entry entry) =>
MapImeOptions((IEntryHandler)handler, entry);

public static void MapText(EntryHandler handler, Entry entry)
{
if (handler.DataFlowDirection == DataFlowDirection.FromPlatform)
{
Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, entry);
return;
}

public static void MapText(EntryHandler handler, Entry entry) =>
MapText((IEntryHandler)handler, entry);
}

public static void MapImeOptions(IEntryHandler handler, Entry entry)
{
Expand All @@ -29,6 +21,12 @@ public static void MapImeOptions(IEntryHandler handler, Entry entry)

public static void MapText(IEntryHandler handler, Entry entry)
{
if (handler is ViewHandler viewHandler && viewHandler.DataFlowDirection == DataFlowDirection.FromPlatform)
{
Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, entry);
return;
}

Platform.EditTextExtensions.UpdateText(handler.PlatformView, entry);
}

Expand Down
28 changes: 14 additions & 14 deletions src/Controls/src/Core/Entry/Entry.Mapper.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
#nullable disable
using System;

namespace Microsoft.Maui.Controls
{
public partial class Entry
{
[Obsolete("Use EntryHandler.Mapper instead.")]
public static IPropertyMapper<IEntry, EntryHandler> ControlsEntryMapper =
new PropertyMapper<Entry, EntryHandler>(EntryHandler.Mapper)
{
#if ANDROID
[PlatformConfiguration.AndroidSpecific.Entry.ImeOptionsProperty.PropertyName] = MapImeOptions,
#elif WINDOWS
[PlatformConfiguration.WindowsSpecific.InputView.DetectReadingOrderFromContentProperty.PropertyName] = MapDetectReadingOrderFromContent,
#elif IOS
[PlatformConfiguration.iOSSpecific.Entry.CursorColorProperty.PropertyName] = MapCursorColor,
[PlatformConfiguration.iOSSpecific.Entry.AdjustsFontSizeToFitWidthProperty.PropertyName] = MapAdjustsFontSizeToFitWidth,
#endif
[nameof(Text)] = MapText,
[nameof(TextTransform)] = MapText,
};
new PropertyMapper<Entry, EntryHandler>(EntryHandler.Mapper);

internal static new void RemapForControls()
{
// Adjust the mappings to preserve Controls.Entry legacy behaviors
EntryHandler.Mapper = ControlsEntryMapper;
#if ANDROID
EntryHandler.Mapper.ReplaceMapping<Entry, IEntryHandler>(PlatformConfiguration.AndroidSpecific.Entry.ImeOptionsProperty.PropertyName, MapImeOptions);
#elif WINDOWS
EntryHandler.Mapper.ReplaceMapping<Entry, IEntryHandler>(PlatformConfiguration.WindowsSpecific.InputView.DetectReadingOrderFromContentProperty.PropertyName, MapDetectReadingOrderFromContent);
#elif IOS
EntryHandler.Mapper.ReplaceMapping<Entry, IEntryHandler>(PlatformConfiguration.iOSSpecific.Entry.CursorColorProperty.PropertyName, MapCursorColor);
EntryHandler.Mapper.ReplaceMapping<Entry, IEntryHandler>(PlatformConfiguration.iOSSpecific.Entry.AdjustsFontSizeToFitWidthProperty.PropertyName, MapAdjustsFontSizeToFitWidth);
#endif
EntryHandler.Mapper.ReplaceMapping<Entry, IEntryHandler>(nameof(Text), MapText);
EntryHandler.Mapper.ReplaceMapping<Entry, IEntryHandler>(nameof(TextTransform), MapText);

#if ANDROID
EntryHandler.CommandMapper.PrependToMapping(nameof(IEntry.Focus), MapFocus);
Expand Down
15 changes: 10 additions & 5 deletions src/Controls/src/Core/FlyoutPage/FlyoutPage.Mapper.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
using System;

namespace Microsoft.Maui.Controls
{
/// <include file="../../../docs/Microsoft.Maui.Controls/FlyoutPage.xml" path="Type[@FullName='Microsoft.Maui.Controls.FlyoutPage']/Docs/*" />
public partial class FlyoutPage
{
public static IPropertyMapper<IFlyoutView, FlyoutViewHandler> ControlsFlyoutPageMapper = new PropertyMapper<IFlyoutView, FlyoutViewHandler>(FlyoutViewHandler.Mapper)
{
[nameof(FlyoutLayoutBehavior)] = (handler, __) => handler.UpdateValue(nameof(IFlyoutView.FlyoutBehavior)),
};
[Obsolete("Use FlyoutViewHandler.Mapper instead.")]
public static IPropertyMapper<IFlyoutView, FlyoutViewHandler> ControlsFlyoutPageMapper = new PropertyMapper<IFlyoutView, FlyoutViewHandler>(FlyoutViewHandler.Mapper);

internal new static void RemapForControls()
{
FlyoutViewHandler.Mapper = ControlsFlyoutPageMapper;
FlyoutViewHandler.Mapper.ReplaceMapping<IFlyoutView, IFlyoutViewHandler>(nameof(FlyoutLayoutBehavior), MapFlyoutLayoutBehavior);
}

internal static void MapFlyoutLayoutBehavior(IFlyoutViewHandler handler, IFlyoutView view)
{
handler.UpdateValue(nameof(IFlyoutView.FlyoutBehavior));
}
}
}
39 changes: 19 additions & 20 deletions src/Controls/src/Core/Label/Label.Mapper.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
#nullable disable
using System;
using Microsoft.Maui.Handlers;

namespace Microsoft.Maui.Controls
{
/// <include file="../../../docs/Microsoft.Maui.Controls/Label.xml" path="Type[@FullName='Microsoft.Maui.Controls.Label']/Docs/*" />
public partial class Label
{
public static IPropertyMapper<ILabel, LabelHandler> ControlsLabelMapper = new PropertyMapper<Label, LabelHandler>(LabelHandler.Mapper)
{
[nameof(TextType)] = MapTextType,
[nameof(Text)] = MapText,
[nameof(FormattedText)] = MapText,
[nameof(TextTransform)] = MapText,
#if WINDOWS
[PlatformConfiguration.WindowsSpecific.InputView.DetectReadingOrderFromContentProperty.PropertyName] = MapDetectReadingOrderFromContent,
#endif
#if IOS
[nameof(TextDecorations)] = MapTextDecorations,
[nameof(CharacterSpacing)] = MapCharacterSpacing,
[nameof(LineHeight)] = MapLineHeight,
[nameof(ILabel.Font)] = MapFont,
[nameof(TextColor)] = MapTextColor,
#endif
[nameof(Label.LineBreakMode)] = MapLineBreakMode,
[nameof(Label.MaxLines)] = MapMaxLines,
};
[Obsolete("Use LabelHandler.Mapper instead.")]
public static IPropertyMapper<ILabel, LabelHandler> ControlsLabelMapper = new PropertyMapper<Label, LabelHandler>(LabelHandler.Mapper);

internal static new void RemapForControls()
{
// Adjust the mappings to preserve Controls.Label legacy behaviors
// ILabel does not include the TextType property, so we map it here to handle HTML text
// And we map some of the other property handlers to Controls-specific versions that avoid stepping on HTML text settings

LabelHandler.Mapper = ControlsLabelMapper;
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(TextType), MapTextType);
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(Text), MapText);
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(FormattedText), MapText);
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(TextTransform), MapText);
#if WINDOWS
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(PlatformConfiguration.WindowsSpecific.InputView.DetectReadingOrderFromContentProperty.PropertyName, MapDetectReadingOrderFromContent);
#endif
#if IOS
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(TextDecorations), MapTextDecorations);
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(CharacterSpacing), MapCharacterSpacing);
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(LineHeight), MapLineHeight);
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(ILabel.Font), MapFont);
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(TextColor), MapTextColor);
#endif
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(Label.LineBreakMode), MapLineBreakMode);
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(Label.MaxLines), MapMaxLines);
}
}
}
Loading