Bind DataForm to radTreeView and save edits

2 posts, 0 answers
  1. CD
    CD avatar
    14 posts
    Member since:
    Mar 2011

    Posted 18 Jul 2011 Link to this post


    I have my Treeview setup to load on demand:

    <DataTemplate x:Name="Sub_SubLevel2"
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="Product ID: " />
            <TextBlock Text="{Binding ProductID}" />
    <telerik:HierarchicalDataTemplate x:Name="SubLevel"
                                      ItemsSource="{Binding Order_Details}"
                                      ItemTemplate="{StaticResource DetailTemplate}">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="Order ID: " />
            <TextBlock Text="{Binding OrderID}" />
    <telerik:HierarchicalDataTemplate x:Name="Root"
                                      ItemsSource="{Binding Orders}"
                                      ItemTemplate="{StaticResource OrderTemplate}">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="Customer ID: " />
            <TextBlock Text="{Binding CustomerID}" />
    <telerik:RadTreeView Background="WhiteSmoke"
                         ItemTemplate="{StaticResource CustomerTemplate}"

    and then it is populated in code-behind:

    this.radTreeView1.ItemsSource = _Context.Customers;
    var loadTree = _Context.Load(_Context.GetCustomersQuery(), LoadBehavior.RefreshCurrent, true);

    I bind the dataform to the tree:
    <telerik:RadDataForm x:Name="radDataForm"
                         CurrentItem="{Binding Path=SelectedItem, ElementName=radTreeView1}" />

    When I run, it works as expected with the dataform showing the detail for the item selected in the tree.

    Save Edits (not working)
    private void radDataForm_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e)
        _Context.SubmitChanges(so =>
            string errorMsg = string.Empty;
            if (so.HasError)
                errorMsg = "failed";
                errorMsg = "succeeded";
            MessageBox.Show("Update " + errorMsg);
        }, null);

    I would like to be able to edit in the dataform, and submit the changes back to the database. Is there an example on how to do this?

    Thank you.
  2. CD
    CD avatar
    14 posts
    Member since:
    Mar 2011

    Posted 19 Jul 2011 Link to this post

    I believe my issue is with the DataForm validation. I am going to start another thread with a new topic.
Back to Top