Skip to content

Commit 3c33c23

Browse files
Merge pull request #153 from PrithisIyyappan/main
Resolved the crash in TextInputLayout when resizing the Window.
2 parents 572e8ff + c05c3e1 commit 3c33c23

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

maui/src/Core/Extensions/CanvasExtensions.Windows.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ public static void DrawText(this ICanvas canvas, string value, Rect rect, Horizo
129129

130130
format.HorizontalAlignment = canvasHorizontalAlignment;
131131
format.Options = CanvasDrawTextOptions.Clip;
132-
w2DCanvas.Session.DrawText(value, new Windows.Foundation.Rect(rect.X, rect.Y, rect.Width, rect.Height), textElement.TextColor.AsColor(), format);
132+
if(rect.Width >= 0 && rect.Height >= 0)
133+
{
134+
w2DCanvas.Session.DrawText(value, new Windows.Foundation.Rect(rect.X, rect.Y, rect.Width, rect.Height), textElement.TextColor.AsColor(), format);
135+
}
133136
}
134137
}
135138
}

maui/src/TextInputLayout/SfTextInputLayout.Methods.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,10 @@ void DrawOutlinedBorder(ICanvas canvas)
19431943
if (((IsLayoutFocused && !string.IsNullOrEmpty(Hint)) || IsHintFloated) && ShowHint)
19441944
{
19451945
CalculateClipRect();
1946-
canvas.SubtractFromClip(_clipRect);
1946+
if(_clipRect.Width >= 0 && _clipRect.Height >= 0)
1947+
{
1948+
canvas.SubtractFromClip(_clipRect);
1949+
}
19471950
}
19481951

19491952
SetOutlinedContainerBackground(canvas);

0 commit comments

Comments
 (0)