Information menu on the phone "Hold for Windows"

Is it possible to create some kind of information menu when the button fires the Hold event. I looked a little in ContextMenu, but it does not close automatically when you stop holding. What I want is PopUp or a similar thing that shows some information when the Hold button is pressed and closes when it is no longer "Holded". Is it possible, and in that case, what should I use?

+4
source share
2 answers

I would suggest that the solution might be to use a popup as you say. Therefore, when a hold event is fired, you display a popup using your finger position. When the user releases the screen, the event with the completion of manipulation should be fired, then you can use a boolean value to check whether this was a hold event or not.

If this was a hold event, you close the popup or delete it if you need to remove it from memory.

+1
source

Yes, you can use the Popup Class to display any kind of message or any other parameter you want.

Refer to some of these samples:

Windows 8 phone popup

WP8: ?

hold toolkit:

XAML:

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

<toolkit:GestureService.GestureListener>
     <toolkit:GestureListener Hold="GroupItem_Hold"/>
 </toolkit:GestureService.GestureListener>

<toolkit:ContextMenuService.ContextMenu>
                                <toolkit:ContextMenu>

                                    <toolkit:MenuItem Header="Remove Group" Click="removeGroup"/>
                                </toolkit:ContextMenu>
                            </toolkit:ContextMenuService.ContextMenu>

.cs:

  private void removeGroup(object sender, RoutedEventArgs e)
        {
        //do something here
        }

 private void GroupItem_Hold(object sender, GestureEventArgs e)
        {
        var holdItem = (sender as StackPanel).DataContext as Usergroup;

        App.selectedGroup = holdItem.id.ToString();

        grp_name = holdItem.groupName;
        }

, , .

, :)

0

Source: https://habr.com/ru/post/1545659/


All Articles