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

StyleManager that uses current theme

4 Answers 156 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Goran
Top achievements
Rank 1
Goran asked on 18 May 2012, 12:30 PM
I have the following requirement: I have modified styles taken from Implicit styles project, in order to achieve some custom appearance for TreeListView. When I run the application with this style, everything works fine. Next requirement is that I need to paint the background differently for each row based on some property value of item in collection.

<RadTreeListView RowStyleSelector="{StaticResource TaskRowStyleSelector}" />
 
<Style x:Key="PendingTreeListViewRowStyle" TargetType="telerik:TreeListViewRow">
    <Setter Property="Background" Value="#FFFFE1C4" />
</Style>
 
<local:PersonRowStyleSelector x:Key="TaskRowStyleSelector"
                    PendingStyle="{StaticResource PendingTreeListViewRowStyle}"
                           .../>

And I have a TaskSelector which inherits from using System.Windows.Controls;StyleSelector. When I run the application, background is applied correctly, however I am loosing custom style that I made for RadTreeListView and RadTreeListViewItem. Next thing I tried is to add BasedOn attribute in above style, but then it doesn't paint the background (Setter Background doesn't do anything)..

So, how can I use style selector, set a background property, while preserving the custom made style for RadTreeListView and its sub elements.

4 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 22 May 2012, 06:34 AM
Hi Goran,

 


An important aspect of styles and style selectors is that if you set the respective Style or RowStyleSelector

the StyleSelector would not be applied and it will be ignored. This means that the RowStyle combined with StyleSelector cannot work simultaneously. What you may do here is to use a single style targeted at TreeListViewRow which modifies the appearance of these rows based on your custom logic. 




Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Goran
Top achievements
Rank 1
answered on 22 May 2012, 12:05 PM
Hi Vanya,

to summarize: When I have an implicit style for RadTreeListView, and then use RowStyleSelector, the implicit style for TreeListViewRow will be overriden by the RowStyleSelector style?

What I have also tried is to have styles that are used in RowStyleSelector inherit from my implicit TreeListViewRow style (using BasedOn), but the background property isnt applied at all? I am guessing the reason is that GridViewCell style is being applied after TreeListViewRow style.

If I don't inherit from TreeListViewRow style, then I will have completely different look than expected.

Regards,
Goran
0
Vanya Pavlova
Telerik team
answered on 23 May 2012, 06:57 AM
Hello Goran,

 

In order to avoid any misleading would it be possible to prepare small sample demo, which illustrates your specific scenario and send it to us as an attachment in a new support ticket? 



Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Goran
Top achievements
Rank 1
answered on 24 May 2012, 08:10 PM
Hi Vanya,

after I have prepared a sample project, it worked as expected in it. Most probably there is a problem with my implicit style then, so I am going to investigate this further. Sorry for caused inconvenience.

Goran
Tags
TreeListView
Asked by
Goran
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Goran
Top achievements
Rank 1
Share this question
or