Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bbfe8d6
Improve label mapping performance and ensure complete coverage includ…
devanathan-vaithiyanathan Jun 11, 2026
9a5bd7c
UnShipped changes included
devanathan-vaithiyanathan Jun 11, 2026
8a456a6
Candidate failure changes added
devanathan-vaithiyanathan Jun 12, 2026
c95ea7a
build error issue resolved
devanathan-vaithiyanathan Jun 18, 2026
3a190bd
removed dead code
devanathan-vaithiyanathan Jun 24, 2026
19a1427
image re save and TextFieldExtension changes added
devanathan-vaithiyanathan Jun 29, 2026
21456c3
AI summary addressed
devanathan-vaithiyanathan Jun 30, 2026
3a034d9
AI suggestion addressed
devanathan-vaithiyanathan Jul 1, 2026
ed41541
AI summary addressed
devanathan-vaithiyanathan Jul 2, 2026
0689b93
AI summary addressed
devanathan-vaithiyanathan Jul 6, 2026
dba4e70
Update Button.iOS.cs
devanathan-vaithiyanathan Jul 8, 2026
58d1d6a
AI summary addressed
devanathan-vaithiyanathan Jul 10, 2026
90ce53d
AI summary addressed
devanathan-vaithiyanathan Jul 14, 2026
35ad904
AI summary addressed
devanathan-vaithiyanathan Jul 15, 2026
e5ba479
Revert "AI summary addressed"
devanathan-vaithiyanathan Jul 15, 2026
a39880c
AI summary addressed
devanathan-vaithiyanathan Jul 15, 2026
4156c76
AI summary addressed
devanathan-vaithiyanathan Jul 16, 2026
09c0f20
Update EntryHandler.cs
devanathan-vaithiyanathan Jul 17, 2026
dcbca33
ai summary addressed
devanathan-vaithiyanathan Jul 21, 2026
bfd16b5
changes added
devanathan-vaithiyanathan Jul 21, 2026
b9cd676
android 36 images updated
devanathan-vaithiyanathan Jul 21, 2026
9441ea3
AI summary addressed
devanathan-vaithiyanathan Jul 22, 2026
ea14b30
Update FormattedStringExtensions.cs
devanathan-vaithiyanathan Jul 23, 2026
6eea165
Windows and Android Snaps are re-saved
devanathan-vaithiyanathan Jul 27, 2026
43afeec
unwanted changes removed
devanathan-vaithiyanathan Jul 29, 2026
17c9127
Update Issue34583.cs
devanathan-vaithiyanathan Jul 29, 2026
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
13 changes: 12 additions & 1 deletion src/Controls/src/Core/Button/Button.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public partial class Button
#endif
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(Text), MapText);

ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(TextTransform), MapText);
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(TextTransform), MapTextTransform);
ButtonHandler.Mapper.ReplaceMapping<Button, IButtonHandler>(nameof(Button.LineBreakMode), MapLineBreakMode);
}

Expand All @@ -44,5 +44,16 @@ public static void MapContentLayout(IButtonHandler handler, Button button)

public static void MapContentLayout(ButtonHandler handler, Button button) =>
MapContentLayout((IButtonHandler)handler, button);

static void MapTextTransform(IButtonHandler handler, Button button)
{
if (button.IsConnectingHandler())
{
// If we're connecting the handler, we don't want to map the text multiple times.
return;
}

MapText(handler, button);
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
}
}
6 changes: 6 additions & 0 deletions src/Controls/src/Core/Button/Button.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ private static void MapPadding(IButtonHandler handler, Button button)
public static void MapText(IButtonHandler handler, Button button)
{
handler.PlatformView?.UpdateText(button);

if (!handler.IsConnectingHandler())
{
// Any text update requires that we update any attributed string formatting
ButtonHandler.MapFormatting(handler, button);
}
}

internal static void MapBorderWidth(IButtonHandler handler, Button button)
Expand Down
12 changes: 12 additions & 0 deletions src/Controls/src/Core/Editor/Editor.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,17 @@ public static void MapText(EditorHandler2 handler, Editor editor)

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

// Material3 specific overload for EditorHandler2
internal static void MapTextTransform(EditorHandler2 handler, Editor editor)
{
if (editor.IsConnectingHandler())
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
{
// If we're connecting the handler, we don't want to map the text multiple times.
return;
}

MapText(handler, editor);
}
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
}
17 changes: 14 additions & 3 deletions src/Controls/src/Core/Editor/Editor.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public partial class Editor
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);
EditorHandler.Mapper.ReplaceMapping<Editor, IEditorHandler>(nameof(TextTransform), MapTextTransform);

#if ANDROID
if (RuntimeFeature.IsMaterial3Enabled)
{
EditorHandler2.Mapper.ReplaceMapping<Editor, EditorHandler2>(nameof(Text), MapText);
EditorHandler2.Mapper.ReplaceMapping<Editor, EditorHandler2>(nameof(TextTransform), MapText);
EditorHandler2.Mapper.ReplaceMapping<Editor, EditorHandler2>(nameof(TextTransform), MapTextTransform);
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
EditorHandler2.Mapper.AppendToMapping<Editor, EditorHandler2>(nameof(VisualElement.IsFocused), InputView.MapIsFocused);
EditorHandler2.CommandMapper.PrependToMapping<Editor, EditorHandler2>(nameof(IEditor.Focus), InputView.MapFocus);
}
Expand All @@ -38,5 +38,16 @@ public partial class Editor
EditorHandler.CommandMapper.PrependToMapping(nameof(IEditor.Focus), InputView.MapFocus);
#endif
}

static void MapTextTransform(IEditorHandler handler, Editor editor)
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
{
if (editor.IsConnectingHandler())
{
// If we're connecting the handler, we don't want to map the text multiple times.
return;
}

MapText(handler, editor);
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
}
}
7 changes: 5 additions & 2 deletions src/Controls/src/Core/Editor/Editor.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ public static void MapText(IEditorHandler handler, Editor editor)
{
Platform.TextExtensions.UpdateText(handler.PlatformView, editor);

// Any text changes in the editor field require recalculating the CharacterSpacing by regenerating the attributed string to properly apply the spacing and override the current text formatting.
handler?.UpdateValue(nameof(CharacterSpacing));
if (!handler.IsConnectingHandler())
{
// Any text changes in the editor field require recalculating the CharacterSpacing by regenerating the attributed string to properly apply the spacing and override the current text formatting.
handler?.UpdateValue(nameof(CharacterSpacing));
}
}
}
}
12 changes: 12 additions & 0 deletions src/Controls/src/Core/Entry/Entry.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,17 @@ public static void MapText(EntryHandler2 handler, Entry entry)

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

// Material3 specific overload for EntryHandler2
internal static void MapTextTransform(EntryHandler2 handler, Entry entry)
{
if (entry.IsConnectingHandler())
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
{
// If we're connecting the handler, we don't want to map the text multiple times.
return;
}

MapText(handler, entry);
}
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
}
15 changes: 13 additions & 2 deletions src/Controls/src/Core/Entry/Entry.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public partial class Entry
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);
EntryHandler.Mapper.ReplaceMapping<Entry, IEntryHandler>(nameof(TextTransform), MapTextTransform);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[moderate] Android Platform / Mapper Lifecycle — This changes the TextTransform mapping to skip MapText while the legacy EntryHandler is connecting, but the Material3 Android mapping just below still uses EntryHandler2.Mapper.ReplaceMapping(... nameof(TextTransform), MapText). With RuntimeFeature.IsMaterial3Enabled, the TextTransform mapper is still appended to the handler and runs during initial UpdateProperties after the text/formatting mappers, so Material3 entries keep the old connection-time second text assignment that this PR is trying to remove. Add an EntryHandler2-compatible MapTextTransform overload and use it for the Material3 mapping as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[major] Handler Mapper and Property Patterns — The guarded MapTextTransform is only wired for the legacy EntryHandler; the Material3 branch below still maps TextTransform directly to MapText. With RuntimeFeature.IsMaterial3Enabled, connecting an Entry with text transform still invokes MapText once for Text and again for TextTransform, so the Material3 path keeps the duplicate initial mapping this change is trying to prevent. Wire EntryHandler2's TextTransform mapping to a guarded Material3-compatible overload as well.


// Material3 Entry Handler mappings
#if ANDROID
if (RuntimeFeature.IsMaterial3Enabled)
{
EntryHandler2.Mapper.ReplaceMapping<Entry, EntryHandler2>(PlatformConfiguration.AndroidSpecific.Entry.ImeOptionsProperty.PropertyName, MapImeOptions);
EntryHandler2.Mapper.ReplaceMapping<Entry, EntryHandler2>(nameof(Text), MapText);
EntryHandler2.Mapper.ReplaceMapping<Entry, EntryHandler2>(nameof(TextTransform), MapText);
EntryHandler2.Mapper.ReplaceMapping<Entry, EntryHandler2>(nameof(TextTransform), MapTextTransform);
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
EntryHandler2.Mapper.AppendToMapping(nameof(VisualElement.IsFocused), InputView.MapIsFocused);
EntryHandler2.Mapper.AppendToMapping(nameof(VisualElement.IsVisible), InputView.MapIsVisible);
EntryHandler2.CommandMapper.PrependToMapping(nameof(IEntry.Focus), InputView.MapFocus);
Expand All @@ -42,5 +42,16 @@ public partial class Entry
EntryHandler.CommandMapper.PrependToMapping(nameof(IEntry.Focus), InputView.MapFocus);
#endif
}

static void MapTextTransform(IEntryHandler handler, Entry entry)
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
{
if (entry.IsConnectingHandler())
{
// If we're connecting the handler, we don't want to map the text multiple times.
return;
}

MapText(handler, entry);
}
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
}
9 changes: 8 additions & 1 deletion src/Controls/src/Core/Entry/Entry.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ public static void MapAdjustsFontSizeToFitWidth(IEntryHandler handler, Entry ent
public static void MapText(IEntryHandler handler, Entry entry)
{
Platform.TextExtensions.UpdateText(handler.PlatformView, entry);
EntryHandler.MapFormatting(handler, entry);

if (!handler.IsConnectingHandler())
{
// If we're not connecting the handler, we need to update the text formatting
// This is because the text may have changed, and we need to ensure that
// any attributed string formatting is applied correctly.
EntryHandler.MapFormatting(handler, entry);
}
}

public static void MapCursorColor(EntryHandler handler, Entry entry) =>
Expand Down
8 changes: 7 additions & 1 deletion src/Controls/src/Core/Label/Label.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ static void MapTextTransform(ILabelHandler handler, Label label) =>
static void MapFormattedText(ILabelHandler handler, Label label)
{
if (label.IsConnectingHandler())
{
// If we're connecting the handler, we don't want to map the text multiple times.
return;
}

MapText(handler, label);
}
Expand Down Expand Up @@ -167,7 +170,10 @@ static void MapTextColor(ILabelHandler handler, Label label, Action<IElementHand
{
// if there is formatted text,
// then we re-apply the whole formatted text
handler.UpdateValue(nameof(FormattedText));
if (!handler.IsConnectingHandler())
{
handler.UpdateValue(nameof(FormattedText));
}
}
else if (label.TextType == TextType.Text || !label.TextColor.IsDefault())
{
Expand Down
7 changes: 5 additions & 2 deletions src/Controls/src/Core/Label/Label.iOS.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable disable
using System;
using Microsoft.Maui.Controls.Platform;
using Microsoft.Maui.Graphics;
using UIKit;
Expand All @@ -23,7 +22,11 @@ public static void MapText(ILabelHandler handler, Label label)
{
Platform.LabelExtensions.UpdateText(handler.PlatformView, label);

MapFormatting(handler, label);
if (!handler.IsConnectingHandler())
{
// Any text update requires that we update any attributed string formatting
MapFormatting(handler, label);
}
}

public static void MapLineBreakMode(ILabelHandler handler, Label label)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ public static NSAttributedString ToNSAttributedString(
Font? defaultFont = null,
Color? defaultColor = null,
TextTransform defaultTextTransform = TextTransform.Default)
=> formattedString.ToNSAttributedString(fontManager, defaultLineHeight, defaultHorizontalAlignment, defaultFont, defaultColor, defaultTextTransform, LineBreakMode.WordWrap, defaultCharacterSpacing: 0d);
=> formattedString.ToNSAttributedString(fontManager, LineBreakMode.WordWrap, defaultLineHeight, defaultHorizontalAlignment, defaultFont, defaultColor, defaultTextTransform);

internal static NSAttributedString ToNSAttributedString(
this FormattedString formattedString,
IFontManager fontManager,
LineBreakMode defaultLineBreakMode,
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
double defaultLineHeight = -1,
TextAlignment defaultHorizontalAlignment = TextAlignment.Start,
Font? defaultFont = null,
Color? defaultColor = null,
TextTransform defaultTextTransform = TextTransform.Default)
=> formattedString.ToNSAttributedString(fontManager, defaultLineHeight, defaultHorizontalAlignment, defaultFont, defaultColor, defaultTextTransform, defaultLineBreakMode, defaultCharacterSpacing: 0d);

internal static NSAttributedString ToNSAttributedString(
this FormattedString formattedString,
Expand Down Expand Up @@ -82,7 +93,18 @@ public static NSAttributedString ToNSAttributedString(
Font? defaultFont = null,
Color? defaultColor = null,
TextTransform defaultTextTransform = TextTransform.Default)
=> span.ToNSAttributedString(fontManager, defaultLineHeight, defaultHorizontalAlignment, defaultFont, defaultColor, defaultTextTransform, LineBreakMode.WordWrap, defaultCharacterSpacing: 0d);
=> span.ToNSAttributedString(fontManager, defaultLineHeight, defaultHorizontalAlignment, defaultFont, defaultColor, defaultTextTransform, defaultLineBreakMode: LineBreakMode.WordWrap);

internal static NSAttributedString ToNSAttributedString(
this Span span,
IFontManager fontManager,
LineBreakMode defaultLineBreakMode,
double defaultLineHeight = -1,
TextAlignment defaultHorizontalAlignment = TextAlignment.Start,
Font? defaultFont = null,
Color? defaultColor = null,
TextTransform defaultTextTransform = TextTransform.Default)
=> span.ToNSAttributedString(fontManager, defaultLineHeight, defaultHorizontalAlignment, defaultFont, defaultColor, defaultTextTransform, defaultLineBreakMode, defaultCharacterSpacing: 0d);

internal static NSAttributedString ToNSAttributedString(
this Span span,
Expand All @@ -92,7 +114,7 @@ internal static NSAttributedString ToNSAttributedString(
Font? defaultFont,
Color? defaultColor,
TextTransform defaultTextTransform,
LineBreakMode lineBreakMode,
LineBreakMode defaultLineBreakMode,
double defaultCharacterSpacing = 0d)
{
var defaultFontSize = defaultFont?.Size ?? fontManager.DefaultFontSize;
Expand Down Expand Up @@ -123,14 +145,13 @@ internal static NSAttributedString ToNSAttributedString(
_ => UITextAlignment.Left
};

style.LineBreakMode = lineBreakMode switch
style.LineBreakMode = defaultLineBreakMode switch
{
LineBreakMode.NoWrap => UILineBreakMode.Clip,
LineBreakMode.WordWrap => UILineBreakMode.WordWrap,
LineBreakMode.CharacterWrap => UILineBreakMode.CharacterWrap,
LineBreakMode.HeadTruncation => UILineBreakMode.HeadTruncation,
LineBreakMode.TailTruncation => UILineBreakMode.TailTruncation,
LineBreakMode.MiddleTruncation => UILineBreakMode.MiddleTruncation,
LineBreakMode.TailTruncation => UILineBreakMode.TailTruncation,
_ => UILineBreakMode.WordWrap
};

Expand Down
12 changes: 12 additions & 0 deletions src/Controls/src/Core/SearchBar/SearchBar.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,17 @@ public static void MapText(SearchBarHandler2 handler, SearchBar searchBar)

Platform.EditTextExtensions.UpdateText(handler.PlatformView.EditText, searchBar);
}

// Material3 specific overload for SearchBarHandler2
internal static void MapTextTransform(SearchBarHandler2 handler, SearchBar searchBar)
{
if (searchBar.IsConnectingHandler())
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
{
// If we're connecting the handler, we don't want to map the text multiple times.
return;
}

MapText(handler, searchBar);
}
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
}
17 changes: 14 additions & 3 deletions src/Controls/src/Core/SearchBar/SearchBar.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ static SearchBar()
{
// Material3 SearchBar handler mappings
SearchBarHandler2.Mapper.ReplaceMapping<SearchBar, SearchBarHandler2>(nameof(Text), MapText);
SearchBarHandler2.Mapper.ReplaceMapping<SearchBar, SearchBarHandler2>(nameof(TextTransform), MapText);
SearchBarHandler2.Mapper.ReplaceMapping<SearchBar, SearchBarHandler2>(nameof(TextTransform), MapTextTransform);
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
else
{
SearchBarHandler.Mapper.ReplaceMapping<SearchBar, ISearchBarHandler>(nameof(Text), MapText);
SearchBarHandler.Mapper.ReplaceMapping<SearchBar, ISearchBarHandler>(nameof(TextTransform), MapText);
SearchBarHandler.Mapper.ReplaceMapping<SearchBar, ISearchBarHandler>(nameof(TextTransform), MapTextTransform);
}
#else
SearchBarHandler.Mapper.ReplaceMapping<SearchBar, ISearchBarHandler>(nameof(Text), MapText);
SearchBarHandler.Mapper.ReplaceMapping<SearchBar, ISearchBarHandler>(nameof(TextTransform), MapText);
SearchBarHandler.Mapper.ReplaceMapping<SearchBar, ISearchBarHandler>(nameof(TextTransform), MapTextTransform);
#endif

#if IOS || ANDROID
Expand All @@ -47,5 +47,16 @@ static SearchBar()
SearchBarHandler.CommandMapper.PrependToMapping(nameof(ISearchBar.Focus), InputView.MapFocus);
#endif
}

static void MapTextTransform(ISearchBarHandler handler, SearchBar searchBar)
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
{
if (searchBar.IsConnectingHandler())
{
// If we're connecting the handler, we don't want to map the text multiple times.
return;
}

MapText(handler, searchBar);
}
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
}
8 changes: 7 additions & 1 deletion src/Controls/src/Core/SearchBar/SearchBar.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ public static void MapSearchBarStyle(ISearchBarHandler handler, SearchBar search
public static void MapText(ISearchBarHandler handler, SearchBar searchBar)
{
Platform.SearchBarExtensions.UpdateText(handler.PlatformView, searchBar);
SearchBarHandler.MapFormatting(handler, searchBar);

// Any text update requires that we update any attributed string formatting.
// During handler connection these properties are applied by the normal mapper sweep after Text.
if (!handler.IsConnectingHandler())
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
{
SearchBarHandler.MapFormatting(handler, searchBar);
}
Comment on lines +23 to +26
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.
}
Comment on lines 17 to 27
Comment thread
devanathan-vaithiyanathan marked this conversation as resolved.

internal static void MapUserInteraction(ISearchBarHandler handler, SearchBar searchBar)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@
</Button>

<Label Grid.Row="1"
Text="Clicked Event: "/>
Text="Clicked Event: "
AutomationId="MainLabel">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="MainLabel_Tapped"/>
</Label.GestureRecognizers>
</Label>
<Label Grid.Row="1"
Grid.Column="1"
x:Name="ClickedEventLabel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Microsoft.Maui.Controls.Internals;

namespace Maui.Controls.Sample;

public class ButtonControlPage : NavigationPage
Expand Down Expand Up @@ -52,4 +54,17 @@ public void OnButtonReleased(object sender, EventArgs e)
ReleasedEventLabel.Text = "Released Event Executed";
}
}

void MainLabel_Tapped(object sender, TappedEventArgs e)
{
// Recreate the page to verify initial mappers
ToolbarItems.Clear();
Content = new ContentView();
INameScope scope = this;
scope.UnregisterName("ClickedEventLabel");
scope.UnregisterName("ReleasedEventLabel");
scope.UnregisterName("PressedEventLabel");
scope.UnregisterName("ButtonShadow");
InitializeComponent();
}
}
Loading
Loading