Maybe this is easy, but I didn't find a solution for my problem yet.
When I use binding and a user changes for example the text in a textbox, how can I perform some backround checks like:
Without binding this is easy i just call the functions that do the trick.
Example:
<TextBox x:Name="textbox_Name" Height="23" Margin="108,37,20,0" TextWrapping="Wrap" Text="{Binding Name,UpdateSourceTrigger=LostFocus}" VerticalAlignment="Top"/>
Normaly I woud do something like:
if(!Database.isExistingObject(textbox_Name.Text)
{ ObjectXYZ.Name=textbox_Name.Text;
}
With binding the name gets directly changed(Two way binding)...how can I check it before its changed?
You can still call your background checks if you call them right after the user has updated the textbox content.
private string name;
public string Name
{
get
{
return name;
}
set
{
CheckName(value); // Or whatever are you check functions
name = value;
PropertyChanged("Name");
}
}
I hope this helps.