0
votes

I need to select item with right-click in the ListBox control. How to do it in UWP?

Thank you. Best wishes.

1
As @lindexi said, you can subscribe the RightTapped event for your each item, then set the SelectedItem of ListBox as sender in the event, does this work?Faywang - MSFT

1 Answers

0
votes

You can add the RightTapped event in your item.

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

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

And then you can write the GridColection_OnRightTapped in your code and handle the right click event