I implemented a textbox, and this binds to a viewmodel. I fill in the textbox default by '100' for example, but if i change this to 10, the property always sets correctly. But when i delete all the numbers, i want that the property is set to null. But it just don't set the value when nothing is filled in. He just keeps the last value..
this is my code , viewmodel + xaml:
public double MaxTime
{
get
{
return maxTime;
}
set
{
maxTime = value;
OnPropertyChanged("MaxTime");
if (SelectedQuestionDropList != null)
{
foreach (QuestionCluster cluster in this.Examination.QuestionClusters)
{
if (cluster == SelectedQuestionDropList)
{
cluster.MaxTime = value;
}
}
}
}
}
<TextBox Height="23"
Visibility="{Binding Path=VisibleClusterDetails, Converter={StaticResource boolToVis},UpdateSourceTrigger=PropertyChanged}"
Text="{Binding Path=MaxTime,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
HorizontalAlignment="Right" Margin="0,511,601,0" Name="textBox2"
VerticalAlignment="Top" Width="120" />