Skip to content

Button wont get disabled at startup #20347

Open

Description

Description

i'm trying to disable a button based on an Entry's Text.Length but it won't get disabled at startup when the entry is empty, but then when i type in the entry and clear it out, the button gets disabled, i tried using DataTriggers and also binding the Button.IsEnabled to Text.Length using a converter but none of them work at startup

Steps to Reproduce

either use this:

<Button
    Command="{Binding AddSectionCommand}"
    CommandParameter="{Binding Section}"
    IsEnabled="{Binding Source={x:Reference txtTitle}, Path=Text.Length, Converter={StaticResource lengthConverter}}"
    Text="Save"/>

or this:

<Button
    Command="{Binding AddSectionCommand}"
    CommandParameter="{Binding Section}"
    Text="Save">
    <Button.Triggers>
        <DataTrigger
            Binding="{Binding Source={x:Reference txtTitle}, Path=Text.Length}"
            TargetType="Button"
            Value="0">
            <Setter Property="IsEnabled" Value="False" />
        </DataTrigger>
    </Button.Triggers>
</Button>

Link to public reproduction project repository

No response

Version with bug

8.0.6

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12.0

Did you find any workaround?

No response

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions