This question is locked. New answers and comments are not allowed.
Hi All,
I have a RadGridView control like this,
<twc:RadGridView ItemsSource="{Binding Values}" AutoGenerateColumns="False" SelectedItem="{Binding SelectedValue, Mode=TwoWay}" >
<twc:RadGridView.Columns>
<twc:GridViewDataColumn
x:Name="ValueColumn"
Header="Values"
MinWidth="100"
DataMemberBinding="{Binding Value, NotifyOnValidationError=True}" />
<twc:GridViewDataColumn
x:Name="DescriptionColumn"
Header="Description"
MinWidth="250"
DataMemberBinding="{Binding Explanation}" IsReadOnly="True"/>
</twc:RadGridView.Columns>
</twc:RadGridView>
The first column there binds to a property like this,
public decimal? Value
{
get { return _value; }
set
{
_value = value;
RaisePropertyChanged("Value");
if (value > 200)
{
throw new ValidationException("Invalid ...");
}
}
}
The problem is that I enter 200 into that field, which is valid. I then enter 2000 into the field, which causes a validation exception. I then enter 200 into the field again, and the value immediately changes to 2000.
The reason is that the second time I enter 200 the control doesn't update the binding, thus the value of 'Value' in the view model doesn't get updated. This means that the control calls the getter and the value of 2000 is shown.
It is as though the control considers the value 2000 to be invalid, so the control still thinks of its original value as being 200. You then change it back to 200 and the control thinks 'oh, that's the same as it used to be, so I don't have to update the binding'.
Any ideas?
I have a RadGridView control like this,
<twc:RadGridView ItemsSource="{Binding Values}" AutoGenerateColumns="False" SelectedItem="{Binding SelectedValue, Mode=TwoWay}" >
<twc:RadGridView.Columns>
<twc:GridViewDataColumn
x:Name="ValueColumn"
Header="Values"
MinWidth="100"
DataMemberBinding="{Binding Value, NotifyOnValidationError=True}" />
<twc:GridViewDataColumn
x:Name="DescriptionColumn"
Header="Description"
MinWidth="250"
DataMemberBinding="{Binding Explanation}" IsReadOnly="True"/>
</twc:RadGridView.Columns>
</twc:RadGridView>
The first column there binds to a property like this,
public decimal? Value
{
get { return _value; }
set
{
_value = value;
RaisePropertyChanged("Value");
if (value > 200)
{
throw new ValidationException("Invalid ...");
}
}
}
The problem is that I enter 200 into that field, which is valid. I then enter 2000 into the field, which causes a validation exception. I then enter 200 into the field again, and the value immediately changes to 2000.
The reason is that the second time I enter 200 the control doesn't update the binding, thus the value of 'Value' in the view model doesn't get updated. This means that the control calls the getter and the value of 2000 is shown.
It is as though the control considers the value 2000 to be invalid, so the control still thinks of its original value as being 200. You then change it back to 200 and the control thinks 'oh, that's the same as it used to be, so I don't have to update the binding'.
Any ideas?