This is a migrated thread and some comments may be shown as answers.

StartEdit

6 Answers 68 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Paul Gallen
Top achievements
Rank 1
Paul Gallen asked on 15 May 2009, 11:27 AM
Hi,


In your documentation, it quotes "or programmatically by using the StartEdit() method of the RadTreeViewItem.". I have a treeviewitem, but VS complains; StartEdit is not a member of RadTreeviewItem.

Have I missed something, or was this method omitted from the build.

My requirement is to startedit a RadTreeviewItem in code


Thanks


P

6 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 15 May 2009, 02:46 PM
Hello Paul,

There is a mistake in our documentation, the real method is  BeginEdit(); and we will change it for the next release. Sorry for the inconvenience.

Sincerely yours,
Boyan
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.
0
Paul Gallen
Top achievements
Rank 1
answered on 15 May 2009, 03:34 PM
Thanks Boyan

I have now used BeginEdit(), however I get an error message after this call
"Object reference not set to an instance of an object."
"   at Telerik.Windows.Controls.RadTreeViewItem.BeginEdit() in c:\Builds\WPF_Scrum\WPF_Team\Sources\Development\Silverlight\Telerik.Windows.Controls.Navigation\TreeView\RadTreeViewItem.cs:line 396"

My RadTreeView is not data bound, as it it is constructed by code. I can use F2 to go into edit mode, but I am at a loss why this call (BeginEdit) has caused an error. I have a valid RadTreeviewItem

Code snippet

 

Dim blh As BaseListHierarchy = Me.ListEventFolder.MakeList(True)

 

 

Me.EventNode.CollapseAll() ' Root node

 

 

Me.EventNode.IsExpanded = True

 

 

Dim tvi As RadTreeViewItem = FindNode(blh.Name, False)

 

tvi.IsSelected =

True

 

tvi.BeginEdit() 'Error

P

0
Paul Gallen
Top achievements
Rank 1
answered on 15 May 2009, 03:51 PM
Hi Boyan,

It seems that If I have my Rootnode is already expanded this error does not occur, although it still does not go into edit mode. I am using LoadOnDemand. If I collapse my nodes and expanded them, in code, the load on demand gets fired, my tree is built, then I get my node that I have just created and call BeginEdit


Hope it throws a bit more light


P
0
Tihomir Petkov
Telerik team
answered on 18 May 2009, 01:36 PM
Hello Paul,

I suspect the problem may not be in the BeginEdit() method but rather a matter of calling it in the right time. Can you please send me your project so that I can take a look?

Sincerely yours,
Tihomir Petkov
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.
0
Paul Gallen
Top achievements
Rank 1
answered on 19 May 2009, 11:28 AM
Thanks Tihomir ,

Unfortunately my project is huge, it will take me a long time to unravel it to produce a sample. Is it possible that you can give me an example on how to create a treeviewitem and add it to a root treeviewitem which is collapsed, then expand the collapsed root node with the newly created treeviewitem in edit mode using load on Demand ?


Thanks


P
0
Miroslav
Telerik team
answered on 19 May 2009, 12:58 PM
Hi Paul,

There are many things that happen asynchronously in such a case and it is necessary to wait for them:

If you have the container you can call BeginEdit()
- The container needs to be generated
- the treeViewItem parent needs to be expanded
- The items source of the tree view needs to be set
- the items source of the tree view item needs to be fetched.

You need to wait for each of these operations, since there is no real indication when they happen. To help you with this:

We have the ItemPrapared event on the TreeView which will inform you when an item is generated
The IsLoadingOnDemand property of the TreeView shows whether it is in the process of loading child items.

You can use these events + dispatch some call (if there is a small delay).

I created a sample project where I am simulating a laod on demand with dealy of 1 sec + adding an item to a non-expanded TreeViewItem, you can find the project attached.

Sincerely yours,
Miroslav
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.
Tags
TreeView
Asked by
Paul Gallen
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Paul Gallen
Top achievements
Rank 1
Tihomir Petkov
Telerik team
Miroslav
Telerik team
Share this question
or