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

Drag/Drop process: How to set drag tooltip for a Header property when i.e. Grid control is used as a header

2 Answers 61 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 16 Nov 2010, 10:59 AM
Is it possible to change a tooltip of a header property when a header contains i.e. grid control. It is not user friendly when during drag/drop process user see a tooltip that can look like that "Drop In System.Windows.Control.Grid". When a header contains just a text it looks ok but if it contains a control there is such a problem. Some example code to reproduce mentioned problem:
Grid grid = new Grid();
var image = new Image(); //Set some picture for example
var header = new TextBlock { Text = "Header" };
 
Grid.SetRow(image, 0);
Grid.SetColumn(image, 0);
Grid.SetRow(header, 0);
Grid.SetColumn(header, 1);
 
grid.Children.Add(image);
grid.Children.Add(header);
var item = new RadTreeViewItem { Header = grid };

radTreeView.Items.Add(item);

2 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 18 Nov 2010, 05:20 PM
Hi Marcin,

The TreeViewDragCue control is used to display the DragCue and it can be styled accordingly to your needs. However, your scenario cannot be implemented out-of-the-box since the TreeViewDragCue control is an ItemsControl and you have to modify its ControlTemplate and replace the ItemsPresenter accordingly to your needs.

Also, there are a couple of points that have to be taken into consideration. Firstly, you have to make sure that the TreeViewDragCue is changed only to the Items that cannot be properly displayed. You can handle the  DragInfo() event and do a sample if statement.

Secondly, you will have to make sure that the DragToolTipContent of the "Grid-Headered" items is also updated accordingly. Therefore you have to handle the DropInfo() event as well.

I prepared a sample project for you , illustrating the described approach.

Still, I was wondering why you need to set the RadTreeViewItem Header to a Grid. If you need to display an Image within each RadTreeViewItem, you can take advantage of the built-in Image functionality of the RadTreeViewItem. You can find more info here. I also demonstrated this approach in the attached example. As you can see, in this case, you don't have to manually configure the TreeViewDragCue.

I hope this information helps. Please let us know if you need more info.

Sincerely yours,
Tina Stancheva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Marcin
Top achievements
Rank 1
answered on 19 Nov 2010, 10:58 AM
Thanks a lot for the explanation and the example code. Of course you are right that the built-in Image functionality is sufficient for the purpose of the problem I mentioned. But your answer is a very usefull information anyway. Thanks again.

Best regards
Marcin
Tags
TreeView
Asked by
Marcin
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Marcin
Top achievements
Rank 1
Share this question
or