New Treeviewitem - Fails on BeginEdit

2 posts, 0 answers
  1. Paul Gallen
    Paul Gallen avatar
    156 posts
    Member since:
    Jun 2008

    Posted 20 May 2009 Link to this post


    given the code below is there any reason why my NewNode.Begin edit is causing an exception - object ref not set to an instance of an object. This works fine if I omit the BeginEdit

      Dim NewNode As New RadTreeViewItem  
            NewNode.Header = Now  
            Me.CurrentTreeViewItem.IsExpanded = True 
            NewNode.IsSelected = True 

  2. Valentin.Stoychev
    Valentin.Stoychev avatar
    2198 posts

    Posted 25 May 2009 Link to this post

    Hi Paul Gallen,

    The problem with this code is that the new item is still not generated, because of the asynchronous nature of the Silverlight layout system.

    To resolve this, you need to call the BeginEdit method with Dispatcher.Invoke:

    Dispatcher.BeginInvoke(AddressOf EditNode)  

    Private Sub EditNode()  
    End Sub 

    Please let us know if you have any problems with this approach.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top