Skip to content

[Bug]: x:Bind from a string to a non-string property is falsely reported as an error (WXAML0030) #352

Open

Description

Describe the bug

Binding a string source with x:Bind to targets like Background, Foreground, Width, Margin, Visibility or IsEnabled is reported as an Error WXAML0030, although the XAML compiler inserts a conversion and the app runs.

To Reproduce

  1. Add public string Title { get; } to the view model.
  2. In a page, add <Border Background="{x:Bind ViewModel.Title}"/> or <Button Width="{x:Bind ViewModel.Title}"/>.
  3. See WXAML0030 The x:Bind result type 'string' is not assignable to 'Brush'.

Expected behavior

No diagnostic for string sources the compiler accepts. Truly incompatible types (int to bool, Color to Brush) are still flagged.

Notes

Related: #203. Bug bash ID: C-11.

Screenshots

No response

OS Version and details

Windows 11 x64 (10.0.26200), VS Code 1.143.1, .NET SDK 10.0.403. Found in the XAML IntelliSense bug bash on 0.3.1-prerelease.456 (PR #276, f90df977).

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

Metadata

Metadata

Labels

bugintellisense

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions