ListBox选择带有右键单击UWP的项目

问题描述 投票:0回答:1

我需要右键单击ListBox控件来选择项目。如何在UWP中执行此操作?

谢谢。最好的祝福。

c# uwp listbox
1个回答
0
投票

您可以在项目中添加RightTapped事件。

    <ListView ItemsSource="{x:Bind TheData}">            

            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid Background="#FFda2a5c" RightTapped="GridColection_OnRightTapped">
                        <TextBlock Text="{Binding}"></TextBlock>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

然后您可以在代码中编写GridColection_OnRightTapped并处理右键单击事件

© www.soinside.com 2019 - 2024. All rights reserved.