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

RadTreeView: Drag text shows namespace

5 Answers 132 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Raj
Top achievements
Rank 1
Raj asked on 20 Feb 2009, 09:45 PM
I have a RadTreeView bound to a collection of business objects. This works great. However, when I drag a node the associated drag text displays the manespace of my object (example: companyname.library.class) 

How do I change this text to show the actual display text of the node. I've also noticed similar behavior when editing a node - the pre-populated edit text is the namespace.

5 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 23 Feb 2009, 01:46 PM
Hello Raj,

Thank you for the good question. Please take a look at the following online example:

http://demos.telerik.com/silverlight/default.aspx#TreeView/DragDrop

It shows how to bind a RadTreeView to a custom collection of objects and how to use the drag and drop functionality. In addition to that, you can also see how to customize the displayed text.

I hope this answers your question.

Greetings,
Boryana
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
Raj
Top achievements
Rank 1
answered on 23 Feb 2009, 03:27 PM
Hi Boryana,

Thank you for your response. However, it's of little help. First of all you're not binding to objects, you're binding to an xml doc. Secondly, it doesn't show anywhere how to manipulate the drag text. I'm still not sure why the drag text shows the class name by default. There is no instance I could think of where I would ever want this to be shown.

I'm trying to evaluate the rad silverlight controls to determine if we want to use them in a product we're currently building. So far it has been extremely frustrating. The docs of the objects are incredibly sparse with no examples and the online help (http://www.telerik.com/help/silverlight) covers only the most trivial scenarios.

I would truly appreciate some guidance that does not just point me to samples that I've already seen. Specifically, how to display the node text instead of the class name when I drag and also when I edit a node. Also, do you have any samples that are a bit more substantial.

Thanks & Regards,
Raj

0
Raj
Top achievements
Rank 1
answered on 24 Feb 2009, 03:07 PM
I came up with a solution for this issue. The scenario is I have a WCF service returning a business object that is being bound to the tree. The problem occurred when trying to drag or edit a node - the default drag text (and edit text) was displaying the business object class name instead of the node text.

What I had to do was extend the generated proxy class to include an override to ToString(). Since the proxy is a partial class, I added another class file that was also part of that class that is within the same namespace as the proxy class...

namespace SameAsProxyClass
{
  public partial class ProxyBusinessObject()
  {
        public override string ToString()
        {
            return this.NodeName;
        }
  }
}

0
Bobi
Telerik team
answered on 24 Feb 2009, 03:46 PM
Hello Raj,

I am glad you have found a solution to your problem. Please let me know if you have further questions.

Regards,
Boryana
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
James
Top achievements
Rank 1
answered on 26 Mar 2009, 06:15 PM
Thanks for posting that Raj - I'd been puzzling over the same thing.
James.
Tags
TreeView
Asked by
Raj
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Raj
Top achievements
Rank 1
James
Top achievements
Rank 1
Share this question
or