You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried to use a record as a one way view model but it seems impossible. Microsoft.UI.Xaml.Markup.Compiler generates code like:
private void set_3_Item_Name(object instance, object Value)
{
var that = (global::App5.Item)instance;
that.Name = (global::System.String)Value;
}
which generates error CS8852: Init-only property or indexer 'ISomething.Property' can only be assigned in an object initializer, or on 'this' or 'base' in an instance constructor or an 'init' accessor.
Steps to reproduce the bug
Create a record type like public record ReadOnlyModel(string Name);
Try to bind to it using {x:Bind Name, Mode=OneTime}
The project doesn't compile
Expected behavior
Able to bind to properties with init accessor just like to "get only" properties.
Screenshots
No response
NuGet package version
1.0.0
Packaging type
Packaged (MSIX), Unpackaged
Windows version
Windows 11 version 21H2 (22000)
IDE
Visual Studio 2022-preview, Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
Tried to use a record as a one way view model but it seems impossible. Microsoft.UI.Xaml.Markup.Compiler generates code like:
which generates
error CS8852: Init-only property or indexer 'ISomething.Property' can only be assigned in an object initializer, or on 'this' or 'base' in an instance constructor or an 'init' accessor.
Steps to reproduce the bug
public record ReadOnlyModel(string Name);
{x:Bind Name, Mode=OneTime}
Expected behavior
Able to bind to properties with
init
accessor just like to "get only" properties.Screenshots
No response
NuGet package version
1.0.0
Packaging type
Packaged (MSIX), Unpackaged
Windows version
Windows 11 version 21H2 (22000)
IDE
Visual Studio 2022-preview, Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered: