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

x:Bind works for structs in OneWay but not TwoWay #9170

Open
asklar opened this issue Dec 17, 2023 · 1 comment
Open

x:Bind works for structs in OneWay but not TwoWay #9170

asklar opened this issue Dec 17, 2023 · 1 comment
Labels
area-Binding bug Something isn't working team-Markup Issue for the Markup team

Comments

@asklar
Copy link
Member

asklar commented Dec 17, 2023

Describe the bug

when doing TwoWay x:Bind to a struct, the code that xaml compiler generates assumes it is bound to a runtimeclass, so it uses the setter method, resulting in code like foo.MyProperty(value). For structs, it should write foo.MyProperty = value.

The getter seems correct, however, so this is an oversight.

Somewhat related to #517

Steps to reproduce the bug

<ItemsRepeater ItemsSource="{x:Bind Waffles}">
    <ItemsRepeater.ItemTemplate>
        <DataTemplate x:DataType="local:Waffle">
            <CheckBox Content="{x:Bind Name}" IsChecked="{x:Bind Enabled,Mode=TwoWay}" />
        </DataTemplate>
    </ItemsRepeater.ItemTemplate>
</ItemsRepeater>

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5 Experimental 1: 1.5.231202003-experimental1

Windows version

No response

Additional context

No response

@asklar asklar added the bug Something isn't working label Dec 17, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 17, 2023
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@bpulliam bpulliam added area-Binding team-Markup Issue for the Markup team and removed needs-triage Issue needs to be triaged by the area owners labels Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Binding bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

2 participants