Skip to content

TextField no longer displays Clear button when AllowClear=true #861

@StepKie

Description

@StepKie

Reproduction branch:
https://github.com/StepKie/MauiPlayground/tree/uranium/textfield-clear-861
To reproduce, start typing into the first text field (clear icon does not show at the start in either case when initial Text is set directly in xaml, which might be the desired behavior, not sure)


Edit: Additional information: it depends on the exact combination of .net and UraniumUI.
A particular incompatibility seems introduced in UraniumUI 2.10.0:

TextField.ClearIcon:

DOES NOT SHOW: - .net9.0, UraniumUI nuget >=2.10.0 ( 2.10.0- 2.11.2 tested)
DOES SHOW - .net9.0, UraniumUI nuget <2.10.0 (2.7.4 - 2.9.1 tested)
DOES SHOW - .net8.0, UraniumUI latest nuget

TextField no longer shows ClearIcon when using net9.0

<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<ItemGroup>
	<PackageReference Include="CommunityToolkit.Maui" Version="11.1.0" />
	<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
	<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.50" />
	<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.50" />
	<PackageReference Include="UraniumUI.Material" Version="2.11.0" />
	<PackageReference Include="UraniumUI.Icons.MaterialIcons" Version="2.11.0" />
	<PackageReference Include="UraniumUI.Dialogs.CommunityToolkit" Version="2.11.0" />
	<PackageReference Include="UraniumUI.Validations.DataAnnotations" Version="2.11.0" />
</ItemGroup>

Code for this:

<VerticalStackLayout>
  <Label HorizontalOptions="Center" Text="Here, the first text field is not clearable:" />
  <material:TextField Title="Clearable TextField" AllowClear="True" Text="Test Text" />
  <material:TextField Title="Non-Clearable TextField" AllowClear="False" Text="Test Text" />
  <Label HorizontalOptions="Center" Text="For contrast, DatePicker is still clearable" />
  <material:DatePickerField Title="Clearable DatePicker" AllowClear="True" />
  <material:DatePickerField Title="Not-Clearable DatePicker" AllowClear="False" />
</VerticalStackLayout>

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions