Skip to content

How do I get the selected item in the BindableListView? #43

Answered by ChebanovDD
KTolmachevSP asked this question in Q&A
Discussion options

You must be logged in to vote

There are two approaches, with and without the UnityMvvmToolkit.Generator.

Let's say we have the following ViewModels.

MyItemViewModel with UnityMvvmToolkit.Generator
public partial class MyItemViewModel : ICollectionItem
{
    public MyItemViewModel()
    {
        Id = Guid.NewGuid().GetHashCode();
    }

    public int Id { get; }

    [WithObservableBackingField]
    public string Name
    {
        get => _name.Value;
        set => _name.Value = value;
    }
}
MyItemViewModel without UnityMvvmToolkit.Generator
public partial class MyItemViewModel : ICollectionItem
{
    private readonly IProperty<string> _name = new Property<string>();

    public MyItemViewModel()
    {
        Id 

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@KTolmachevSP
Comment options

@ChebanovDD
Comment options

@KTolmachevSP
Comment options

Answer selected by ChebanovDD
Comment options

You must be logged in to vote
1 reply
@ChebanovDD
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants