Skip to content

Conditional XAML not working in ResourceDictionaries #2556

@michael-hawker

Description

@michael-hawker

Describe the bug
Been having trouble trying to add more complex conditional XAML to our Resource Dictionaries (like just copying resources from the WinUI repo here that is using the same syntax is failing in our C# UWP Class Library).

The latest message I've received is Type 'TemplateBinding' used after '{' must be a Markup Extension. Error code 0x09cc. which seems similar to this old thread here.

Steps to reproduce the bug

  1. Clone WCT repo
  2. Open a ResourceDictionary for a control like (TokenizingTextbox.AutoSuggestBox.xaml)
  3. Paste in a system style for AutoSuggestBox (grabbed from Generic.xaml from 18362 for instance)
  4. Use VS Quick-Fix tip to apply conditional XAML for Description property.
  5. Try and compile. This should be valid XAML, but it fails.

I noticed this as well when trying to apply CornerRadius conditionally as well.

Expected behavior
Compile and run.

Screenshots
image

Version Info
Class Library Min: 16299, Target 17763

Windows 10 version Saw the problem?
May 2020 Update (19041) Yes
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT

VS 2019 16.5.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed-internallyThis bug has been fixed, and the fix will be shipped in the next version of WinUI 3.needs-triageIssue needs to be triaged by the area ownersteam-MarkupIssue for the Markup teamwct

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions