Hello,
In our application we have an edit dialog that uses DataForm which contains DataFormDataFields which are binded to different properties from view model. Also in dialog are used two RadButtons for save edited data and cancel edit. This buttons are set to response on "Esc" and "Enter" keys. When user press "Enter" key, the new data modifications are save. The problem is that the last edited DataFormDataField (the last field in which was modified a value) does not save the modified value. Below is the code we use:
Thank you.
Best regards,
Alexander
In our application we have an edit dialog that uses DataForm which contains DataFormDataFields which are binded to different properties from view model. Also in dialog are used two RadButtons for save edited data and cancel edit. This buttons are set to response on "Esc" and "Enter" keys. When user press "Enter" key, the new data modifications are save. The problem is that the last edited DataFormDataField (the last field in which was modified a value) does not save the modified value. Below is the code we use:
<
UserControl
x:Class
=
"MyApplication.MyView"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Height
=
"400"
Width
=
"500"
>
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"EditEmployeeTemplate"
>
<
StackPanel
>
<
telerik:DataFormDataField
Label
=
"First name"
DataMemberBinding
=
"{Binding FirstName, Mode=TwoWay, UpdateSourceTrigger=Default}"
/>
<
telerik:DataFormDataField
Label
=
"Last name"
DataMemberBinding
=
"{Binding LastName, Mode=TwoWay, UpdateSourceTrigger=Default}"
/>
<
telerik:DataFormDataField
Label
=
"Middle name"
DataMemberBinding
=
"{Binding MiddleName, Mode=TwoWay, UpdateSourceTrigger=Default}"
/>
<
telerik:DataFormDataField
Label
=
"Nickname"
DataMemberBinding
=
"{Binding Contact.Nickname, Mode=TwoWay, UpdateSourceTrigger=Default}"
/>
<
telerik:DataFormDateField
Label
=
"Birthday"
DataMemberBinding
=
"{Binding Contact.BirthDay, Mode=TwoWay, UpdateSourceTrigger=Default}"
/>
<
telerik:DataFormDataField
Label
=
"Language"
DataMemberBinding
=
"{Binding Contact.Language, Mode=TwoWay, UpdateSourceTrigger=Default}"
/>
</
StackPanel
>
</
DataTemplate
>
</
UserControl.Resources
>
<
StackPanel
>
<
telerik:RadDataForm
CurrentItem
=
"{Binding Employee}"
EditTemplate
=
"{StaticResource EditEmployeeTemplate}"
BorderBrush
=
"Transparent"
CommandButtonsVisibility
=
"None"
AutoGenerateFields
=
"False"
x:Name
=
"Form"
AutoEdit
=
"True"
/>
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Stretch"
>
<
telerik:RadButton
Content
=
"Save"
Width
=
"75"
Height
=
"23"
telerik:RadWindow.ResponseButton
=
"Accept"
Margin
=
"0,0,4,0"
Micro:Message.Attach
=
"SaveAction()"
/>
<
telerik:RadButton
Content
=
"Cancel"
Width
=
"75"
Height
=
"23"
Micro:Message.Attach
=
"CancelAction()"
telerik:RadWindow.ResponseButton
=
"Cancel"
/>
</
StackPanel
>
</
StackPanel
>
</
UserControl
>
Thank you.
Best regards,
Alexander