This question is locked. New answers and comments are not allowed.
Good afternoon. I am having problems with synchronization of properties in a RadPropertyGrid.
This is my xaml
<telerik:RadPropertyGrid Name="rpgPropertyEditor" Item="{Binding}" AutoGeneratePropertyDefinitions="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
LabelColumnWidth="130">
<telerik:RadPropertyGrid.PropertyDefinitions>
<telerik:PropertyDefinition DisplayName="Nombre" Binding="{Binding nombre, Mode=TwoWay, ValidatesOnNotifyDataErrors=True}" GroupName="General" Description="Nombre del recurso dentro del item"/>
<telerik:PropertyDefinition DisplayName="Cantidad" Binding="{Binding cantidadAsignada, Mode=TwoWay, ValidatesOnNotifyDataErrors=True}" GroupName="Valuación" Description="Cantidad de recursos asignados al item"/>
</telerik:RadPropertyGrid.PropertyDefinitions>
<i:Interaction.Behaviors>
<behaviors:RadPropertyGridDefualtViewCategoriesBehavior/>
<behaviors:RadPropertyGridIsPropertyEnabledBehavior IsDisabledCollection="{Binding DisableProperties}"/>
</i:Interaction.Behaviors>
</telerik:RadPropertyGrid>
In my ViewModel, I have declared the properties.
private String _nombre;
public String nombre
{
get
{
return _nombre;
}
set
{
if (_nombre != value)
{
_nombre = value;
RaisePropertyChanged("nombre");
SynchronizeChange("nombre", value);
}
}
}
private double? _cantidadAsignada;
public double? cantidadAsignada
{
get
{
return _cantidadAsignada;
}
set
{
if (_cantidadAsignada != value)
{
_cantidadAsignada = value;
RaisePropertyChanged("cantidadAsignada");
SynchronizeChange("cantidadAsignada", value);
}
}
}
When loading the ViewModel, runs a method that Sets an object with these properties.
For example:
nombre = object.nombre;
In this way, I can load the property values in my RadPropertyGrid and by a SynchronizeChange, tell my object, that changed them.
The problem arises when the business logic, modify one of these properties, and to be charged to the View, is not aware of the modification.
As I can do to learn of changes in my objetct?
This would be much easier to solve if I could load the properties as "Binding OBJETCT.PROPERTY, Mode = TwoWay". But as far as I have understood, this does not work very well in the RadPropertyGrid.
Thanks in advance.