C
C
ChymeNik2015-11-29 12:32:13
WPF
ChymeNik, 2015-11-29 12:32:13

How to bind a Dictionary to a ListView with two way binding?

There is a class that describes the data, for example this:

public class Data
{
      string description;
      public string Description
        {
            get
            {
                return description;
            }
            set
            {
                description = value;
            }
        }
}

There is a list
Dictionary<string,Data> DataList=new Dictionary<string,Data>();

How can I bind a DataList to a ListView so that when data is added/removed to this list, data is added to or removed from the ListView (Key and value.Description)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MonkAlex, 2015-11-29
@ChymeNik

The data model looks lousy. I would try to do without the Dictionary.

T
tex0, 2015-11-29
@tex0

Try using ObservableDictionary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question