This is a migrated thread and some comments may be shown as answers.

DataForm - NewItem - ObservableCollection

3 Answers 94 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 08 Oct 2012, 12:14 PM
Hi,

i'm using wpf and RadControls, I bound my Dataform to an ObservableCollection.
I like to add a new item to my Collection on "EditEnded".
private void VerbindungForm1_EditEnded(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs e)
{
    if (e.EditAction == Telerik.Windows.Controls.Data.DataForm.EditAction.Commit)
    {
       ??????????
    }
}

But how do i get the new Item ???
Thanks a lot
best Regards
Ww

3 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 08 Oct 2012, 03:29 PM
Hello,

Would you please specify whether you want to add the new item through the UI? If so, you can use RadDataForm's AddNew method. Can you please clarify, what do you mean by mentioning this: "how do i get the new Item"?

Regards,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 08 Oct 2012, 05:02 PM
hi,

after i raise the EditEnded Event i want to save the new Item in my database. In many cases i can geht the item like this.

Verbindung_obj MyNewItem = e.OriginalSource as Verbindung_obj();

But not in this case. How do i get the Input from the form in my Collection? For example my input was:

Name: NewName
Host: 10.128.15.1
Port: 6550
Password: xyz

Please HELP !!!

Thanks
Rene
0
Ivan Ivanov
Telerik team
answered on 11 Oct 2012, 03:13 PM
Hello,

You want to access the item, that has been edited, am I right? You can try this:

Verbindung_obj   obj = (sender as RadDataForm).CurrentItem as Verbindung_obj;

Kind regards,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DataForm
Asked by
ITA
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
ITA
Top achievements
Rank 1
Share this question
or