Skip to content

Commit ab808ea

Browse files
Mike CorsaroFoda
authored andcommitted
Last change ;)
1 parent e5adfdb commit ab808ea

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Controls/src/Core/InputView/InputView.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,13 @@ public int CursorPosition
184184
// need to always push the xplat -> native value flow in scenarios such as "select all text on focus". If we
185185
// don't do this the native control will handle the input event and move the cursor after we set the selection
186186
// length/cursor position, which is not the desired behavior.
187+
bool forceHandlerUpdate = (int)GetValue(CursorPositionProperty) == value;
187188
SetValue(CursorPositionProperty, value);
188-
Handler?.UpdateValue(nameof(CursorPosition));
189+
190+
if (forceHandlerUpdate)
191+
{
192+
Handler?.UpdateValue(nameof(CursorPosition));
193+
}
189194
}
190195
}
191196

@@ -198,8 +203,13 @@ public int SelectionLength
198203
get { return (int)GetValue(SelectionLengthProperty); }
199204
set
200205
{
206+
bool forceHandlerUpdate = (int)GetValue(SelectionLengthProperty) == value;
201207
SetValue(SelectionLengthProperty, value);
202-
Handler?.UpdateValue(nameof(SelectionLength));
208+
209+
if (forceHandlerUpdate)
210+
{
211+
Handler?.UpdateValue(nameof(SelectionLength));
212+
}
203213
}
204214
}
205215

0 commit comments

Comments
 (0)