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

Styling cell depending on IsReadOnly

2 Answers 82 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Stan
Top achievements
Rank 1
Stan asked on 13 Apr 2011, 06:43 PM
Hi there

I have a TreeListView that have columns that are editable and columns that are readonly. I set the background color to grey for the readonly columns but the background of the expander section and indents on the rows are not being set.

This is the xaml:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Key}" Header="Task ID" IsReadOnly="True" IsFilterable="False" Background="LightGray"/>

Attached is a screenshot of the issue. Any ideas how I can style the indents/expanders too?
Thanks for your help.

2 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 14 Apr 2011, 08:07 AM
Hello Stan,

Indeed the behavior you get is the expected one. Due to the Template Structure of TreeListViewRow the only way you may change the background of the expanders in each row is by editing the template of TreeListViewRow. In this case you need to ensure that always the first column should be readonly and apply the desired background. On the other hand you may change the DisplayIndex property of the readonly columns and you do not need to edit the template of TreeListViewRow, please refer to the following snippet:

<telerik:RadTreeListView  AutoGenerateColumns="False" Margin="40,16,16,112" ItemsSource="{Binding Collection}">
            <telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:TreeListViewTableDefinition ItemsSource="{Binding Collection}"/>
                </telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:RadTreeListView.Columns>
                    <telerik:GridViewDataColumn Background="LightGray"  IsReadOnly="True" Header="P1" DisplayIndex="1" DataMemberBinding="{Binding Property1}"/>
                    <telerik:GridViewDataColumn Header="P2" DataMemberBinding="{Binding Property2}"/>
                    <telerik:GridViewDataColumn Header="P3" DataMemberBinding="{Binding Property3}"/>
                    <telerik:GridViewDataColumn Header="P4" DataMemberBinding="{Binding Property4}"/>
                    </telerik:RadTreeListView.Columns>
        </telerik:RadTreeListView>


In my opinion the second approach is the recommended one, because there is an indentation in each row which is internally handled.


Please let me know how this works for you!


Regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stan
Top achievements
Rank 1
answered on 14 Apr 2011, 05:32 PM
Hi Vanya

Setting the displayindex of the first column to 1 doesn't seem to have solved my issue. The expander background and hierachy indent background still remains white.

Can you advise?
Thanks.
Tags
TreeListView
Asked by
Stan
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Stan
Top achievements
Rank 1
Share this question
or