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

SelectionVisual

3 Answers 92 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 14 Nov 2008, 04:18 PM
Hi,

Can you help. I am trying to write a style for the radTreeViewItem; 'SelectionVisual'. Can you give me a small xaml example, to get me started.

Thanks


P

3 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 18 Nov 2008, 07:12 PM
Hi Paul,

Please find attached a project that contains the themes for all the controls. Feel free to modify the TreeView themes as you need. Unfortunately you need to do that manually due to current problems with the Blend support.

In order to change the SelectionVisual you need to edit the $MyCustomTheme/Themes/TreeView.xaml file and to change the "SelectionVisual" element that is on line 533.

Please let us now if you need more help on that.

All the best,
Valentin.Stoychev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Accepted
Paul Gallen
Top achievements
Rank 1
answered on 19 Nov 2008, 10:47 AM
Thanks Valentin,

Since I am new to XAML and still grasping concepts, I simply have no idea what to change. Can you give me an example of changing the selectionVisual just as an example.

Thanks

P
0
Ivan
Telerik team
answered on 20 Nov 2008, 04:07 PM
Hello Paul,

As our colleague Valentin has already sent all the code, I will just explain what you should do to reach the desired result. Please follow the plan explained bellow:

1. First let us change the application's content - copy the attached RadWindowBlend.xaml file over the existing one in TelerikThemingApplication project - there is a simple Tree with some items.

2. I highly advise you to preview the Common.xaml file from MyCustomTheme project - this is the place where we hold definitions for all common brushes used in our controls. You can edit these brushes in order to recolor RadControls - this approach is addressed in Tweaking the Theme colors article.

3. Preview the TreeView.xaml file (from the Valentin's archive). Especially look at following places:
  - rows 7 and 31 where the SelectedBrush brush is preloaded as a TreeView resource:


  - the row 533 where the usage of the SelectedBrush brush is scripted as main part of SelectionVisual element:


4. One easy way to change the look of selected tree item is to change the SelectedBrush brush in TreeView.xaml file - just clean the row 31 and define a new SelectedBrush brush. In the attached archive in the Step4 folder you can find such a file - just copy it over the existing one in the MyCustomTheme project and preview the result.

5. The second way is to change the SelectionVisual element directly at row 533 (as it is done in file located in the Step5 folder from the attached archive).

6. And finally you can change the TreeViewItem's template completely in order to conform the task you are working on. For example you can preview the code inside the Lookless TreeView example.

Paul, please give it a try and let us know if there are other questions.

Regards,
Ivan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Paul Gallen
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Paul Gallen
Top achievements
Rank 1
Ivan
Telerik team
Share this question
or