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

CheckBoxMode with ItemTemplate

1 Answer 17 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Hermann
Top achievements
Rank 1
Hermann asked on 05 Dec 2019, 11:20 AM

I have the following:

<telerikDataControls:TreeViewDescriptor
        DisplayMemberPath="Title"
        ItemsSourcePath="Children"
        TargetType="{x:Type viewHelpers:GroupSettingsModel}">
    <telerikDataControls:TreeViewDescriptor.ItemTemplate>
        <DataTemplate>
            <Grid Margin="{Binding Path=Level, Converter={StaticResource levelToMarginConverter}}"
                    HeightRequest="40"
                    ColumnSpacing="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
            <telerikTreeView:ExpandCollapseIndicator
                FontSize="Medium"
                WidthRequest="10"
                Margin="15,0"
                VerticalTextAlignment="Center"
                IsLoading="{Binding Path=IsLoading}"
                IsLoadOnDemandEnabled="{Binding Path=IsLoadOnDemandEnabled}"
                IsExpanded="{Binding Path=IsExpanded}"
                IsLeaf="{Binding Path=IsLeaf}" />
            <!--HOW TO ADD CHECKBOX HERE?-->
            <telerikTreeView:ItemText
                Grid.Column="2"
                Margin="8,0,0,0"
                VerticalOptions="Center"
                Text="{Binding Item.Title}" />
                
            </Grid>
        </DataTemplate>
    </telerikDataControls:TreeViewDescriptor.ItemTemplate>
</telerikDataControls:TreeViewDescriptor>

 

Can you tell me how to add back the checkbox to my custom Template?

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 05 Dec 2019, 11:58 AM

Hi Hermann,

Thank you for the provided code.

When the ItemTemplate is set it overrides the default ItemTemplate and the checkbox is not visible. In order to solve this you need to use the TreeView control template.

I have attached a sample that shows how this could be implemented. I have used two TreeView Descriptors. Please find my test project attached and review the Page3.xaml file how the TreeViewDescriptor.ItemTemplate is defined.

I hope I was helpful.

Regards,
Didi
Progress Telerik

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 Feedback Portal and vote to affect the priority of the items
Tags
TreeView
Asked by
Hermann
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or