Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ResourceTreeControl.TreeListViewStyle Property

Gets or sets a TreeListView style that is applied to the Resource Tree. This is a dependency property.

Namespace: DevExpress.Xpf.Scheduling

Assembly: DevExpress.Xpf.Scheduling.v24.2.dll

NuGet Package: DevExpress.Wpf.Scheduling

#Declaration

public Style TreeListViewStyle { get; set; }

#Property Value

Type Description
Style

A Style object providing corresponding style settings.

#Remarks

Target type: DevExpress.Xpf.Grid.TreeListView.

The example below illustrates how to use the TreeListViewStyle to show images for ResourceTree’s items.

<local:TreeNodeTypeImageSelector x:Key="imageSelector" Icon1="{dx:DXImage Image=Add_16x16.png}" Icon2="{dx:DXImage Image=Remove_16x16.png}" Icon3="{dx:DXImage Image=Delete_16x16.png}"/>
<!---->
 <dxsch:ResourceTreeControl.TreeListViewStyle>
    <Style TargetType="dxg:TreeListView">
        <Setter Property="ShowNodeImages" Value="True"/>
        <Setter Property="NodeImageSelector" Value="{StaticResource imageSelector}"/>
    </Style>
</dxsch:ResourceTreeControl.TreeListViewStyle>
 public class TreeNodeTypeImageSelector : TreeListNodeImageSelector {
    public ImageSource Icon1 { get; set; }
    public ImageSource Icon2 { get; set; }
    public ImageSource Icon3 { get; set; }

    public override ImageSource Select(TreeListRowData rowData) {
        var value = (ResourceItem)rowData.Row;
        DataType node = value.SourceObject as DataType;
        if (null != node){
            if (node.Id == 1)
                return Icon1;
            if (node.Id == 2)
                return Icon2;
            if (node.Id == 3)
                return Icon3;
        }
        return null;
    }
}
See Also