Different Style for Parent and Child rows in TreeListView

1 Answer 61 Views
TreeListView
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Renier Pretorius asked on 21 Dec 2022, 05:26 AM

Hi,

I am using a TreeListView to display financial data (element with costs per month) with sub-totals as the parent rows. The data structure is thus homogenous and a good fit for the TreeListView.  The binding and data work perfectly, but now I would like to refine the styling to show a greater contrast between parent and child (e.g. make sub-total rows bold). Is there an simple way to do this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
answered on 21 Dec 2022, 06:00 AM

Found a solution that works.

I added a property to my data objects to indicate whether they are sub-totals or not and then simply added a data trigger in the TreeListViewRowStyle


<UserControl.Resources>
        <Style TargetType="telerik:TreeListViewRow" BasedOn="{StaticResource TreeListViewRowStyle}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsSubTotal}" Value="True">
                    <Setter Property="FontWeight" Value="Bold" />
                </DataTrigger>
            </Style.Triggers>
        </Style>    
    </UserControl.Resources>
    

Tags
TreeListView
Asked by
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or