Let's say I have a MVVM application with a ListView of Items and a TextBox editing a property (Text) of a selected item.
<TextBox Text="{Binding SelectedItem.Text}"/>
<ListBox ItemsSource="{Binding Items}" DisplayMemberPath="Text" SelectedItem="{Binding SelectedItem}"
In my ViewModel I have a ObservableCollection of Items. Each item implements the INotifyPropertyChanged and has the requiered property. If I change the text of my TextBox, the List is not updating because I have only a property without notification:
public class Item : INotifyPropertyChanged
{
public string Text { get; set; }
}
My question is: Is there a way to update the Text-property of my list without using the PropertyChanged like this?:
private string _Text;
public string Text
{
...
set
{
_Text = value;
PropertyChanged("Text");
}
}
Is there a way to fire the PropertyChanged direct from my View after changed the Text of my TextBox - or a different approach?
Thank you for your help!