Unplanned
Last Updated: 29 Jul 2024 09:44 by ADMIN
Walter
Created on: 26 Oct 2023 08:13
Category: TreeView
Type: Feature Request
2
TreeView: Add a context menu to the treeview items
Context menu would be useful to allow users to add / delete items.
1 comment
ADMIN
Didi
Posted on: 29 Jul 2024 09:44

As a solution, you can use the .NET MAUI context menu and add it to the item template of the TreeView on TreeView descriptor Here is an example in the TreeView Descriptor level:

<telerik:RadTreeView x:Name="treeView"
                    Grid.Row="1"
                    ItemsSource="{Binding Countries}">
    <telerik:TreeViewDescriptor TargetType="{x:Type local:Country}"
                            DisplayMemberPath="Name"
                            ItemsSourcePath="Cities" />
    <telerik:TreeViewDescriptor TargetType="{x:Type local:City}">
        <telerik:TreeViewDescriptor.ItemTemplate>
            <DataTemplate>
                <Label Text="{Binding Name}"
                    FontAttributes="Italic">
                    <FlyoutBase.ContextFlyout>
                        <MenuFlyout>
                            <MenuFlyoutItem Text="Go to repo 1"
                        Clicked="MenuFlyoutItem_Clicked"/>
                            <MenuFlyoutItem Text="Go to repo 2"
                        Clicked="MenuFlyoutItem_Clicked_1" />
                        </MenuFlyout>
                    </FlyoutBase.ContextFlyout>
                </Label>
            </DataTemplate>
        </telerik:TreeViewDescriptor.ItemTemplate>
    </telerik:TreeViewDescriptor>
</telerik:RadTreeView>

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.