Skip to content

Property Binding in ViewModel #17

@VPDPersonal

Description

@VPDPersonal

Support for:

private class Person
{
    public int Age { get; set; }

    public string FirstName { get; set; }

    public string LastName { get; set; }
}

[ViewModel]
public partial class PersonViewModel
{
    private readonly Person _person = new() { Age = 25 };

    private string FirstName
    {
        get => _person.FirstName;
        set 
        {
            _person.FirstName = value;
            OnPropertyChanged();
        }
    } 

    [Bind]
    private string LastName
    {
        get => _person.LastName;
        set
        {
            _person.LastName = value;
            OnLastNameChanged();
        }
    }

    [Bind]
    private int Age => _person.Age;
}

Sub-issues

Metadata

Metadata

Assignees

Labels

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions