NodeAdding and NodeAdded never triggered

4 posts, 0 answers
  1. Christian
    Christian avatar
    17 posts
    Member since:
    Oct 2007

    Posted 24 Feb 2012 Link to this post

    Hi,
    I have a treeview set like this in Q1 2012:
                treeViewProjets.DataSource = ViewModel.Projets;
                treeViewProjets.DisplayMember = @"Nom\Nom";
                treeViewProjets.ValueMember = @"Id\Id";
                treeViewProjets.ChildMember = @"Projets\ObjetsProjet";
                treeViewProjets.NodeAdded += new RadTreeView.RadTreeViewEventHandler(treeViewProjets_NodeAdded);
                treeViewProjets.NodeAdding += new RadTreeView.RadTreeViewCancelEventHandler(treeViewProjets_NodeAdding);
                treeViewProjets.NodeFormatting += new TreeNodeFormattingEventHandler(treeViewProjets_NodeFormatting);
    

    I get a root node and many child nodes created, but the events NodeAdded and NodeAdding are never triggered, NodeFormatting triggers fine.

    Any idea?
  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 29 Feb 2012 Link to this post

    Hi Christian,

    The NodesAdding, NodesAdded are fired when a new RadTreeNode is added to the RadTreeNodeCollection. These events are not raised when the binding is set up or when the whole data is reset. 

    If you continue to experience the issue, please give us a more detailed description of your scenario and some code snippets to provide you with further assistance.
     
    Kind regards,
    Julian Benkov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Christian
    Christian avatar
    17 posts
    Member since:
    Oct 2007

    Posted 05 Mar 2012 Link to this post

    So is there an event triggered for added nodes when using a datasource?  I want to set the checked state based on a property on the databound item.  Basically this:

    void treeViewProjets_NodeAdded(object sender, RadTreeViewEventArgs e)
    {
        var sondage = e.Node.DataBoundItem as Sondage;
        e.Node.Checked = sondage.IsVisible;
    }

    What would be the way to set the initial checked state using databinding?
  5. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 08 Mar 2012 Link to this post

    Hi Christian,

    Currently, we not support this functionality for bound mode. I logged this feature request in our Public Issue Tracking System. We will implement ItemDataBound event for this scenario. Currently, you can use and move your code in NodeFormatting event:

    void radTreeView1_NodeFormatting(object sender, Telerik.WinControls.UI.TreeNodeFormattingEventArgs e)
    {
        var sondage = e.Node.DataBoundItem as Sondage;
        e.Node.Checked = sondage.IsVisible;
    }

    I hope this helps.

    Thank you for you time and cooperation. Your Telerik points have been updated.

    Regards,
    Julian Benkov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top