Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug using TextField in CommunityToolkit Popup #801

Open
jldearmas opened this issue Oct 8, 2024 · 0 comments
Open

Bug using TextField in CommunityToolkit Popup #801

jldearmas opened this issue Oct 8, 2024 · 0 comments
Labels
bug-verified A bug that can be reproduced input-field-group
Milestone

Comments

@jldearmas
Copy link

jldearmas commented Oct 8, 2024

Adding a TextField to CommunityToolkit Popup crash the application during Popup initialization.

<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
             xmlns:material="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
             xmlns:input="clr-namespace:InputKit.Shared.Controls;assembly=InputKit.Maui"               
             xmlns:validation="clr-namespace:InputKit.Shared.Validations;assembly=InputKit.Maui"
             x:Class="PopupTextField.LoginPopup" 
             CanBeDismissedByTappingOutsideOfPopup="False" Color="Transparent" >
    <Frame BackgroundColor="White" CornerRadius="16" Padding="24, 40, 24, 24" WidthRequest="488" HeightRequest="429">
        <input:FormView >
            <Grid RowSpacing="24" RowDefinitions="auto,auto,auto,auto,auto" ColumnDefinitions="*"
              Padding="0" HorizontalOptions="Center" VerticalOptions="Center" >

                <material:TextField 
                    Grid.Row="0"
                    HorizontalOptions="FillAndExpand" WidthRequest="430" HeightRequest="56" CornerRadius="4" 
                    AccentColor="{StaticResource Gray950}" TextColor="{StaticResource Gray54}" BorderColor="{StaticResource Gray54}" TitleColor="{StaticResource Gray54}"
                    Title="Username">
                    <validation:RequiredValidation Message="Login Username is required" />
                </material:TextField>

                <material:TextField 
                    Grid.Row="1"
                    HorizontalOptions="FillAndExpand" WidthRequest="430" HeightRequest="56" CornerRadius="4" 
                    AccentColor="{StaticResource Gray950}" TextColor="{StaticResource Gray54}" BorderColor="{StaticResource Gray54}" TitleColor="{StaticResource Gray54}"
                    Title="Password">
                    <validation:RequiredValidation Message="Login Password is required" />
                    <material:TextField.Attachments>
                        <material:TextFieldPasswordShowHideAttachment  />
                    </material:TextField.Attachments>
                </material:TextField>

                <Button WidthRequest="440" HeightRequest="64" CornerRadius="32" Grid.Row="3" BackgroundColor="{StaticResource SolidRedVigilvent}"
                    Text="Enter" TextTransform="Uppercase"
                    input:FormView.IsSubmitButton="True"/>

            </Grid>
        </input:FormView>
    </Frame>
</toolkit:Popup>

PopupTextField-bug-01

Notice that border field is null. Seems that some code executed for a base constructor is the cause of call the property change event of CornerRadius property before the InputField's constructor initialize border field.

If the content of the Popup shown above is placed in a Page everything goes well as such as expect.

Here is the full sample https://github.com/jldearmas/testuraniumui

Probably this is the same problem or is related with #800

It should be better to attack the real problem, but a possible mitigate solution in this case, would be change in InputField this line (444)

		else if (border.StrokeShape is RoundRectangle roundRectangle)

by this one

		else if (border?.StrokeShape is RoundRectangle roundRectangle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-verified A bug that can be reproduced input-field-group
Projects
None yet
Development

No branches or pull requests

2 participants