Hi! I try to use RadDataForm in my WPF MVVM Prism 6 application. Since I began to use this control I've collided with some problems - data from form is not passed into properies of the object to which RadDataForm is bound. Below is the class to object of which RadDataForm is bound:
public class Group : IEditableObject
{
struct GroupData
{
internal string name;
}
private GroupData _newGroupData;
private GroupData _backupGroupData;
private bool _isEditMode = false;
public Group()
{
this._newGroupData = new GroupData();
this._newGroupData.name = string.Empty;
}
public string Name
{
get { return this._newGroupData.name; }
set { this._newGroupData.name = value; }
}
public void BeginEdit()
{
if(!this._isEditMode)
{
this._backupGroupData = this._newGroupData;
this._isEditMode = true;
}
}
public void CancelEdit()
{
if (this._isEditMode)
{
this._newGroupData = this._backupGroupData;
this._isEditMode = false;
}
}
public void EndEdit()
{
if (this._isEditMode)
{
this._backupGroupData = new GroupData();
this._isEditMode = false;
}
}
public override string ToString()
{
StringWriter stringWriter = new StringWriter();
stringWriter.Write(this.Name);
return stringWriter.ToString();
}
}
Then in view model:
private Group _profileElementsGroup;
public Group ProfileElementsGroup
{
get { return this._profileElementsGroup; }
set { this.SetProperty(ref this._profileElementsGroup, value); }
}
<
Grid.Resources
>
<
DataTemplate
x:Key
=
"GroupTemplate"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
/>
<
ColumnDefinition
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
telerik:DataFormDataField
Grid.Row
=
"0"
Label
=
"GroupName"
DataMemberBinding
=
"{Binding ProfileElementsGroup.Name, Mode=TwoWay}"
/>
</
Grid
>
</
DataTemplate
>
</
Grid.Resources
>
<
telerik:RadDataForm
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Top"
AutoGenerateFields
=
"False"
Header
=
"Add Element Group of Profile of Device"
ReadOnlyTemplate
=
"{StaticResource GroupTemplate}"
EditTemplate
=
"{StaticResource GroupTemplate}"
CurrentItem
=
"{Binding ProfileElementsGroup}"
>
<
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:EventBinding
Command
=
"{Binding HandleEndEditNewProfileElementsGroupCommand}"
EventName
=
"EditEnded"
PassEventArgsToCommand
=
"True"
/>
</
telerik:EventToCommandBehavior.EventBindings
>
</
telerik:RadDataForm
>
When I printing in my RadDataForm in Name field I set breakpoint in C# code of Name property and this breakpoint is not activated. So data from RadDataForm doesn't fall into ProfileElementsGroup.Name property. What I do wrong? Please help.