简体   繁体   中英

winui3 Treeview control: How to show tooltip on hover of items in treeview

Can someone please help me to know how I can add tooltip for Treeview control on hover?

Treeview control

You just need to bind it or set directly to ToolTipService.ToolTip .

<TreeView
    Grid.Column="0"
    ItemsSource="{x:Bind ViewModel.Items, Mode=OneWay}">
    <TreeView.ItemTemplate>
        <DataTemplate x:DataType="local:Item">
            <TreeViewItem
                Content="{x:Bind Name}"
                ItemsSource="{x:Bind Children}"
                ToolTipService.ToolTip="{x:Bind Tip, Mode=OneWay}" />
        </DataTemplate>
    </TreeView.ItemTemplate>
</TreeView>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM