Skip to content

Commit dbb67e2

Browse files
Fixed Microsoft.Maui.Controls 8.0.90 (Latest stable) Ruins Entry Controls (#25006)
* Fixed Microsoft.Maui.Controls 8.0.90 (Latest stable) Ruins Entry Controls * Added test cases * updated test case method name * Added automation id * Added pending test snapshot * Added images for android and IOS * Fixed Microsoft.Maui.Controls 8.0.90 (Latest stable) Ruins Entry Controls * Added test cases * updated test case method name * Added automation id * Added images for android and IOS * Added pending test snapshot * Modified ios image * revert unwanted changes * Revert "Added pending test snapshot" This reverts commit 3f66bbb. * modified code changes * Revert "Added pending test snapshot" This reverts commit 269de76. * Reapply "Added pending test snapshot" This reverts commit dd65898. Revert "modified code changes" This reverts commit 8d59b7b. Revert "Modified ios image" This reverts commit daef7ed. * Added pending test snapshot * dummy * Revert "Merge branch 'fix-24783' of https://github.com/NirmalKumarYuvaraj/maui into fix-24783" This reverts commit 8d50a3c, reversing changes made to 15000b8. * Revert "Merge branch 'fix-24783' of https://github.com/NirmalKumarYuvaraj/maui into fix-24783" This reverts commit 15000b8, reversing changes made to daef7ed. * reverted all the changes * Added missing test cases and images * removed unwanted images and files --------- Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
1 parent fb711d4 commit dbb67e2

File tree

7 files changed

+76
-2
lines changed

7 files changed

+76
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues"
5+
x:Class="Maui.Controls.Sample.Issues.Issue25038">
6+
7+
<StackLayout Padding="20">
8+
<!-- First test case: Grid with entry having ClearButtonVisibility set to Never -->
9+
<Grid x:Name="firstEntryGrid" IsVisible="False">
10+
<Entry Text="Initial ClearButton Never Entry" x:Name="initialEntry" ClearButtonVisibility="Never" />
11+
</Grid>
12+
13+
<!-- Second test case: Grid with entry where ClearButtonVisibility changes dynamically -->
14+
<Grid x:Name="secondEntryGrid" IsVisible="False">
15+
<Entry Text="Dynamic ClearButton Entry" x:Name="dynamicClearButtonEntry" ClearButtonVisibility="WhileEditing" />
16+
</Grid>
17+
18+
<!-- Button to trigger the changes -->
19+
<Button Text="Show Entries" AutomationId="button" Clicked="OnShowEntriesClicked"/>
20+
</StackLayout>
21+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.Maui.Controls.Internals;
2+
3+
namespace Maui.Controls.Sample.Issues
4+
{
5+
[XamlCompilation(XamlCompilationOptions.Compile)]
6+
[Preserve(AllMembers = true)]
7+
[Issue(IssueTracker.Github, 25038, "MAUI Entry in Windows always shows ClearButton if initially hidden and shown even if ClearButtonVisibility set to 'Never'", PlatformAffected.UWP)]
8+
public partial class Issue25038 : ContentPage
9+
{
10+
public Issue25038()
11+
{
12+
InitializeComponent();
13+
}
14+
15+
private void OnShowEntriesClicked(object sender, EventArgs e)
16+
{
17+
// Show the first Grid
18+
firstEntryGrid.IsVisible = true;
19+
20+
// Show the second Grid
21+
secondEntryGrid.IsVisible = true;
22+
23+
// Change ClearButtonVisibility of the second Entry to Never
24+
dynamicClearButtonEntry.ClearButtonVisibility = ClearButtonVisibility.Never;
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.TestCases.Tests.Issues
6+
{
7+
public class Issue25038 : _IssuesUITest
8+
{
9+
public Issue25038(TestDevice testDevice) : base(testDevice)
10+
{
11+
}
12+
13+
public override string Issue => "MAUI Entry in Windows always shows ClearButton if initially hidden and shown even if ClearButtonVisibility set to 'Never'";
14+
15+
[Test]
16+
[Category(UITestCategories.Entry)]
17+
[FailsOnMac]
18+
public void VerifyEntryClearButtonVisibility()
19+
{
20+
App.WaitForElement("button");
21+
App.Tap("button");
22+
VerifyScreenshot();
23+
}
24+
}
25+
}
Loading

src/Core/src/Platform/Windows/MauiTextBox.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@ static void OnIsDeleteButtonEnabledPropertyChanged(DependencyObject d, Dependenc
7070
// Adjust the second column's width to 'Auto' when the delete button is enabled, and set it to zero when disabled.
7171
if (deleteButton?.Parent is Grid rootGrid && rootGrid.ColumnDefinitions.Count > 1)
7272
{
73+
int deleteButtonColumnIndex = Grid.GetColumn(deleteButton);
7374
if (GetIsDeleteButtonEnabled(element))
7475
{
75-
rootGrid.ColumnDefinitions[1].Width = new UI.Xaml.GridLength(1, UI.Xaml.GridUnitType.Auto);
76+
rootGrid.ColumnDefinitions[deleteButtonColumnIndex].Width = new UI.Xaml.GridLength(1, UI.Xaml.GridUnitType.Auto);
7677
}
7778
else
7879
{
79-
rootGrid.ColumnDefinitions[1].Width = new UI.Xaml.GridLength(0);
80+
rootGrid.ColumnDefinitions[deleteButtonColumnIndex].Width = new UI.Xaml.GridLength(0);
8081
}
8182
}
8283
}

0 commit comments

Comments
 (0)