Dynamic Styles

4 posts, 1 answers
  1. Andy Grimes
    Andy Grimes avatar
    7 posts
    Member since:
    Aug 2007

    Posted 23 Sep 2008 Link to this post

    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.

  2. Answer
    Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 24 Sep 2008 Link to this post

    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.
  3. Andy Grimes
    Andy Grimes avatar
    7 posts
    Member since:
    Aug 2007

    Posted 24 Sep 2008 Link to this post

    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.
  4. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 25 Sep 2008 Link to this post

    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.
Back to Top