Widget Menu
Add your own options to the right-click widget menu. Widget menu is a quick way how to access some settings. It should not contain too many options - keep it simple and only add options like opening the current photo in the Photos widget.
Examples of adding your own options to the widget menu are in the BeWidgets - Widget Template project.
Adding your own menu options
To add your own menu options, subscribe to the MenuOptionsCreationRequested event. In the event, you'll be able to add your own menu options. Continue to the Methods that add menu options to learn more.
public WidgetPage()
{
...
MenuOptionsCreationRequested += WidgetPage_MenuOptionsCreationRequested;
...
}
private void WidgetPage_MenuOptionsCreationRequested(object sender, MenuOptionsEventArgs e)
{
WidgetApplication.Current.AddWidgetMenuSeparator(); // Separate the original menu options from our
// Here you will add your menu options
}
Methods that add menu options
Add menu option
You can add a menu option using the MenuFlyoutItemBase class. You can create a new UserControl that will inherit from MenuFlyoutItemBase and then add it as a widget menu option.
WidgetApplication.Current.AddWidgetMenuOption(itemType: typeof(MyWidgetMenuOption));
Another option is to add a menu option by entering its text. This will automatically create a new instance of the MenuFlyoutItem class.
MenuFlyoutItem item = WidgetApplication.Current.AddWidgetMenuOption(text: "New option");
Add sub-menu option
Sub-menu can contain another menu items.
MenuFlyoutSubItem subItem = WidgetApplication.Current.AddWidgetMenuSubMenu(text: "Sub menu");
subItem.AddMenuItem(itemType: typeof(MyWidgetMenuOption));
subItem.AddMenuItem(text: "Another item");
Localization support
This documentation is not complete.