Skip to content

x:Bind with cast fails to compile with C++ #10360

Open
@HO-COOH

Description

Describe the bug

Got

error C2665: 'winrt::to_hstring': no overloaded function could convert all the argument types

The exact same code works in C# project

Steps to reproduce the bug

  1. Create a new winui3 C++ project, use this xaml
    <StackPanel>
        <ComboBox x:Name="MyChoice" SelectedIndex="0">
            <x:String>A</x:String>
            <x:String>B</x:String>
        </ComboBox>
        <TextBlock Text="{x:Bind (x:String)MyChoice.SelectedItem, Mode=OneWay}" />
    </StackPanel>
  1. Build and observe the compile error

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.7 Experimental 3: 1.7.250127003-experimental3

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageIssue needs to be triaged by the area owners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions