I have a MVVM app with a ListView
composed of EditableTextblock
s in a DataTemplate
(like this).
Here is my model :
public class MyModel
{
private string _data;
public string Data
{
get { return _data; }
set { _data = value; }
}
}
My viewmodel exposes an ObservableCollection
of MyModel
:
public class MyViewModel
{
[...]
public ObservableCollection<Mymodel> models = new ObservableCollection<MyModel>();
}
and in the view bound to a ListView
:
<ListView ItemsSource={Binding models}>
<!-- code removed for more visibility -->
<DataTemplate>
<controls:EditableTextblock Text="{Binding Data, Mode=TwoWay}" />
</DataTemplate>
<!-- ... -->
</ListView>
Would you have any leads that when in an item in the list I update the value of a Data member, there is a check to see if a value already exists in the collection?
For example, if I update a field to "value 1", it checks if in the models collection there is a member Data that already has this value.
And if it found one, it adds for example a "0" at the end of the member Data.