i have a problem with reading a changed Value:
Binding in XAML:
Text="{Binding Path=Infotext,Mode=TwoWay}"
i try to read a Value (its bound to a Textbox, Class is Ticket, ic_Tickets is a Itemscontrol with "Tickets") by:
string text=((ObservableCollection<Ticket>)ic_Tickets.ItemsSource).Where(Ticket => Ticket.id == ((MenuItem)sender).Tag.ToString()).First().Infotext;
with this (in public class Ticket:INotifyPropertyChanged i got the old bound value
public string Infotext { get
{
return Infotext_int;
}
set {
Infotext_int = value;
NotifyPropertyChanged();
} }
but if i add a Messagebox like this:
public string Infotext { get
{
return Infotext_int;
}
set {
Infotext_int = value;
MessageBox.Show("!!!"); //or inside the NotifyPropertyChanged()
NotifyPropertyChanged();
} }
i get the new Value ... (i want the new Value but it is not a possible way to show allways a Messagebox)
So only it sets the new Value to the Itemssource, when a Messagebox is shown oO
Notify Function:
private void NotifyPropertyChanged(String propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}