DataForm - NewItem - ObservableCollection

4 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 08 Oct 2012 Link to this post

    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
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 08 Oct 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 08 Oct 2012 Link to this post

    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
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 11 Oct 2012 Link to this post

    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.

Back to Top