Add/Edit of Single Item

1 posts, 0 answers
  1. Cheri
    Cheri avatar
    21 posts
    Member since:
    Jan 2012

    Posted 16 May 2012 Link to this post


    We have a RadGridView showing a list of people and a child window using a RadDataForm to show the "people" details. The parent window has an edit button and a create button.  Edit works correctly when displaying the child dataform.  I can't get the Create/Add option to work in the child data form.  I'm assuming I need to call AddNewItem but it doesn't seem to work.

    First, is this possible with a dataform?  I know with AddNewItem I need to use ItemsSource instead of CurrentItem but I can't seem to make it work...

    I'm still new to Silverlight so any help would be appreciated!


    Here's the dataform defintiion..
    <telerik:RadDataForm CurrentItem="{Binding}" ItemsSource="{Binding ElementName=PeopleDomainDataSource, Path=DataView}"
                             AutoGenerateFields="False" Name="rdf" AutoEdit="False"
                             Loaded="rdf_Loaded" AddingNewItem="rdf_AddingNewItem"
                             EditTemplate="{StaticResource EditTemplate}">
                    <TextBlock Margin="10" Text="This is the form NewItemTemplate!" FontWeight="Bold"/>

    Here is the code from the Parent Form that opens the child form

    private void btnCreate_Click(object sender, RoutedEventArgs e)
        SSAssets.Web.SSAssetsDomainContext ctxt = new Web.SSAssetsDomainContext();
        ctxt.Peoples.Add(new SSAssets.Web.People());
        PeopleDetails udWindow = new PeopleDetails();
        udWindow.Closed += new EventHandler(udWindow_Closed);
        //PeopleDetails udWindow = new PeopleDetails.Closed += new EventHandler(PeopleDetails_Closed);
    private void btnEdit_Click(object sender, RoutedEventArgs e)
        var senderElement = e.OriginalSource as FrameworkElement;
        var row = senderElement.ParentOfType<GridViewRow>();
        if (row != null)
            row.IsSelected = true;
            PeopleDetails oWindow = new PeopleDetails();
            oWindow.DataContext = rgv.SelectedItem;
            oWindow.rdf.AutoEdit = true;
Back to Top