Shell.SetMenuItemTemplate(BindableObject, DataTemplate) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the DataTemplate applied to MenuItem objects in the MenuItems collection. Shell provides the Text and IconImageSource properties to the BindingContext of the MenuItemTemplate.
public:
static void SetMenuItemTemplate(Microsoft::Maui::Controls::BindableObject ^ obj, Microsoft::Maui::Controls::DataTemplate ^ menuItemTemplate);
public static void SetMenuItemTemplate (Microsoft.Maui.Controls.BindableObject obj, Microsoft.Maui.Controls.DataTemplate menuItemTemplate);
static member SetMenuItemTemplate : Microsoft.Maui.Controls.BindableObject * Microsoft.Maui.Controls.DataTemplate -> unit
Public Shared Sub SetMenuItemTemplate (obj As BindableObject, menuItemTemplate As DataTemplate)
Parameters
- obj
- BindableObject
The object that sets the DataTemplate applied to MenuItem objects.
- menuItemTemplate
- DataTemplate
The DataTemplate applied to MenuItem objects.
Remarks
Title can be used instead of Text, and Icon instead of IconImageSource. This allows reuse of the same template for menu items and flyout items.