I changed a data structure in my program. I want to have a List instead of a string. Now I have some trouble with the set function. this is the old code
private string user;
public string User
{
get { return user; }
set
{
user = value;
Notify("user");
}
}
I don't know how to manage user = value; This is my try:
private List<string> user;
public List<string> User
{
get { return user; }
set
{
user.Add(value);
Notify("user");
}
}
It throws an error because value is a List and can't be added to a list.
edit: sorry, it was a copy and paste mistake. I changed the old code with this edit.
So, what I want to do is binding a List to a column of a datagrid. The code above is part of an data class.
This is the code in the window.xaml
<DataGridTextColumn Header = "user" Binding="{Binding Path=User, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" MinWidth="50" />