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

11.2.0-beta1 - XAML compiler error when using binding in style setter #16754

Open
pavelovcharov opened this issue Aug 21, 2024 · 1 comment
Open
Labels

Comments

@pavelovcharov
Copy link
Contributor

Describe the bug

Using Avalonia v11.2.0-beta1 I get a compiler error AVLN1000 Avalonia: String '' was not recognized as a valid Boolean when using a binding as a style setter value.

This used to work in v11.1.3.

To Reproduce

Add style as shown below

        <Style Selector="Border.Test">
            <Setter Property="IsVisible">
                <Setter.Value>
                    <MultiBinding Converter="{x:Static BoolConverters.And}">
                        <Binding Path="Test"></Binding>
                        <Binding Path="Test1"></Binding>
                    </MultiBinding>
                </Setter.Value>
            </Setter>
        </Style>

Expected behavior

No compiler error should be thrown, binding should work

Avalonia version

11.2.0-beta1

OS

No response

Additional context

No response

@workgroupengineering
Copy link
Contributor

This issue was introduced by PR #16153.

Possible ways to solve it can be:

  1. Trim textValue before invoke XamlTransformHelpers.TryGetCorrectlyTypedValue at this line
  2. Replace Boolean.Parse with Boolean.TryParse at this line of XamlX
  3. Implement XamlAstTrivia and ingnore when xml:space is undefinited or default

my favorite is option 3 but it's probably the longest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants