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

Dynamic Styles

3 Answers 85 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Andy Grimes
Top achievements
Rank 1
Andy Grimes asked on 23 Sep 2008, 08:12 PM

I have created an irregular tree describing a company reporting structure using the RadTreeView.  The data is provided via. a web service call after which the class structure is created and then assigned to the ItemsSource.

This works great.

Now I would like to be able to apply various styles, such as different colors and fonts, to each node based on provided properties for persons that have specific authorization levels.  For example bold all managers and add a red font.

I see how you can apply a static style such as:
    ItemContainerStyle="{StaticResource ManagerStyle}"

Is there a way I can apply a list of static resources to individual nodes based on a property value?
Example:
    ItemContainerStyle="{Binding StyleNameToApply}"

Any help would be appreciated.

3 Answers, 1 is accepted

Sort by
0
Accepted
Valentin.Stoychev
Telerik team
answered on 24 Sep 2008, 06:51 AM
Hello Andy,

There is a powerful concept for choosing the template for each particular item in our suite. The concept is brought from WPF. You can see more info here:
http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemtemplateselector.aspx

We have an example about how to use the ItemTemplateSelector with RadTreeView here:
http://demos.telerik.com/silverlight/#Examples/TreeView/TemplateSelector

Let us know if you need any help on implementing this.

BTW: do you have any other feedback while working with the treeview control? Can we improve something on our side so you can code better while using the treeview? Your feedback is much appreciated.

Best wishes,
Valentin.Stoychev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Andy Grimes
Top achievements
Rank 1
answered on 24 Sep 2008, 04:32 PM
Valentin,

Thank you for your quick response.  This definitely solved my problem.

As an experienced programmer, but one who is new to WPF programming I found it a challenge to follow some of the examples provided and to find resources to cover topics that were not covered in the initial documentation.  I realize that this is a beta release so this is not a criticism.

Some suggestions:

Some of the examples in the demo use the League/Division/Team data sources and also name the templates the same thing.  This was confusing in many instances because I was not sure if the datasource class or template was being referenced.  After working with it for a while it has become more apparent, but initially it was very confusing.

To someone new to WPF programming and one who has not used a lot of templates, the template and resource concept was confusing.  I was initially expecting the same ASP.Net functionality of creating a datasource with ParentIDs, adding it to controls datasource, settings some properties and I was done except for formatting.  I would suggest making sure that your documentation references the need to be familiar with WPF concepts and pointing to resources that can provide more information to the user.  Once I was aware of this need I was able to do my own research.

More examples.
I found many of the later examples provided to questions posted by users to be of great benefit.  Blog postings by Telerik employees were also helpful.  Making sure these are available in the core documentation would be very beneficial.
I like the ability to programatically update styles, and templates.  Although this may exist I was unable to locate documentation for it when I needed it.

Thanks for the good product and I look forward to using the final release version.
0
Valentin.Stoychev
Telerik team
answered on 25 Sep 2008, 06:13 AM
Hi Andy,

This is great feedback - thanks for sharing! We will address the League/Team data templates naming.

We are currently working on providing a 3-4 very big examples, together with 10 smaller, demonstrating how to use our controls. I hope we will manage to release them within the Q3 timeframe, together with the help updates.

Thanks again for your feedback!

Kind regards,
Valentin.Stoychev
the Telerik team

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