Hello!

I continue with the series of posts on work with Surface Dial. In the previous post I described how to create a menu with 3 options that are activated in the Surface Dial.

If our App needs several menus, one of the options that we may need to take into account is to disable the options that the Surface Dial defaults to. If we do not need vertical scrolling, or do not need Undo / Redo actions, it may be convenient to remove them from the radial menu.

The following image shows the default menu that is shown in the map view of the example with which we are working. In the same we can see the default options and that the 6th element is a custom menu.

I1

Using RadialControllerConfiguration we can control the menu items. The following image shows a menu with only the elements of our App.

I3

We can do this with the following code.


var controller = RadialController.CreateForCurrentView();
controller.RotationResolutionInDegrees = 0.2;
controller.UseAutomaticHapticFeedback = false;
var mapZoomItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno – Maps Zoom", "\xE128", "Segoe MDL2 Assets");
var mapRotationItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno – Map Rotation", "\xE128", "Segoe MDL2 Assets");
var disableDialItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno – Disable Dial", "\xE128", "Segoe MDL2 Assets");
controller.Menu.Items.Add(mapZoomItem);
controller.Menu.Items.Add(mapRotationItem);
controller.Menu.Items.Add(disableDialItem);
var surfaceDialConfiguration = RadialControllerConfiguration.GetForCurrentView();
surfaceDialConfiguration.SetDefaultMenuItems(new List<RadialControllerSystemMenuItemKind>{});
// Add 2 default system buttons
//surfaceDialConfiguration.SetDefaultMenuItems(new[] {
// RadialControllerSystemMenuItemKind.Volume,
// RadialControllerSystemMenuItemKind.NextPreviousTrack
//});

And if we change the commented lines (15 to 19) we can leave in our menu 2 system options [Volume] and [Next Previous Track]; and the App menu items we add by code.

I2

Source Code GitHub

Happy Coding !!!

Saludos @ Toronto

El Bruno

References

2 responses to “#Windows10 – Customizing the default menu items in #SurfaceDial”

  1. […] El Bruno, Customizing the default menu items in Surface Dial […]

    Like

  2. […] El Bruno, Customizing the default menu items in Surface Dial […]

    Like

Leave a reply to #Windows10 – Deshabilitar el menú de #SurfaceDial en una UWP App – El Bruno Cancel reply

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading