Skip to end of metadata
Go to start of metadata

Remarks

UXMenuItem implements both ICommandSource and INavigationSource that allows both commanding and navigation using UXMenuItem. 

You can do commanding through CommandCommandTarget and CommandParameter properties, and navigation using NavigateUri and TargetName properties. To learn more about commanding, see Commanding Overview. To learn about navigation, see Navigation Overview.

Example

XAML


Definition

Summary

The following table summarizes the members exposed in this class.

Public Constructors

UXMenuItem Constructor()Initializes a new instance of the UXMenuItem class.

Public Properties

BoundaryOffsetGets or set the minimum boundary offset.
ClickLatencyGets or sets the latency, in seconds, before the click action is executed.
CommandGets or sets the command to invoke when this button is clicked.
CommandCannotExecuteGets or sets the UI behavior when the associated Command cannot be executed.
CommandParameterGets or sets the parameter to pass to the Command property.
CommandTargetGets or sets the element on which to raise the specified command.
ContentElementGets the content element.
ContentMarginGets or sets the outer margin of content element.
ContentPresenterGets the content presenter.
DefaultCheckedImageSourceGets or sets the checked image source.
DisplayAnimationGets or sets a value that determines the display animation.
EnableFadeInAnimationGets or sets a value that determines whether the fade animation is enabled.
EnableFadeOutAnimationGets or sets a value that determines whether the fade animation is enabled.
GroupNameGets or sets the group name.
HideAnimationGets or sets a value that determines the hide animation.
HorizontalOffsetGets or sets the distance between the left side of the Silverlight control and the left side of the popup.
IconGets or sets the source for the image.
IconTemplateGets or sets the template to apply to Icon element.
ImageHeightGets or sets the height of the image.
ImageMarginGets or sets the margin of the image.
ImageStretchGets or sets the image stretch mode.
ImageWidthGets or sets the width of the image.
IndicatorVisibilityGets or sets the visibility of indicator element.
InputGestureTextGets or sets the input gesture text.
IsCheckableGets or sets a value that determine whether the item is checkable.
IsCheckedGets or seta a value that determine whetehr the item is checked.
IsEnabledGets or sets a value indicating whether the user can interact with the control.
IsOpenGets or sets whether the popup is currently displaying on the screen.
IsSelectableGets or sets a value that indicates whether the item is selectable.
MenuElementGets the menu element.
NavigateUriGets or sets the URI to navigate when this menu item is clicked.
PreferredHorizontalDirectionGets or sets the preferred horizontal direction.
PreferredPositionGets or sets the preferred pop up positions.
PreferredVerticalDirectionGets or sets the preferred vertical direction.
RootElementGets the root element.
SlideDirectionGets or sets a value that determine the slide direction when slide animation is used.
StaysOpenOnClickGets or sets a value that determines whether menu stays open when the item is clicked.
TargetNameGets or sets the name of a target window or frame that will display the content specified by the NavigationUri property.
VerticalOffsetGets or sets the distance between the top of the Silverlight control and the top of the popup.

Protected Properties

HideLatencyTimeoutGets hide latency timeout.
ProductProduct Info.
RequireUpdateCanExecuteDetermines whether the command associated to this button require to be updated in the next call.
ShowLatencyTimeoutGets show latency timeout.

Fields

BoundaryOffsetPropertyIdentifies the BoundaryOffset dependency property.
CheckedEventIdentifies the Checked routed event.
ClickEventIdentifies the Click routed event.
ClickLatencyPropertyIdentifies the BusyLatency dependency property.
CommandCannotExecutePropertyIdentifies the CommandCannotExecute dependency property.
CommandParameterPropertyIdentifies the CommandParameter dependency property.
CommandPropertyIdentifies the Command dependency property.
CommandTargetPropertyIdentifies the CommandTarget dependency property.
ContentMarginPropertyIdentifies the ContentMargin dependency property.
DefaultCheckedImageSourcePropertyIdentifies the ImageSource dependency property.
DisplayAnimationPropertyIdentifies the DisplayAnimation dependency property.
EnableFadeInAnimationPropertyIdentifies the EnableFadeAnimation dependency property.
EnableFadeOutAnimationPropertyIdentifies the EnableFadeAnimation dependency property.
GroupNamePropertyIdentifies the GroupName dependency property.
HideAnimationPropertyIdentifies the HideAnimation dependency property.
HorizontalOffsetPropertyIdentifies the HorizontalOffset dependency property.
IconPropertyIdentifies the ImageSource dependency property.
IconTemplatePropertyIdentifies the IconTemplate dependency property.
ImageHeightPropertyIdentifies the ImageHeight dependency property.
ImageMarginPropertyIdentifies the ImageMargin dependency property.
ImageStretchPropertyIdentifies the ImageStretch dependency property.
ImageWidthPropertyIdentifies the ImageWidth dependency property.
IndicatorVisibilityPropertyIdentifies the IndicatorVisibility dependency property.
InputGestureTextPropertyIdentifies the InputGestureText dependency property.
IsCheckablePropertyIdentifies the IsCheckable dependency property.
IsCheckedPropertyIdentifies the IsChecked dependency property.
IsEnabledPropertyIdentifies the IsEnabled dependency property.
IsOpenPropertyIdentifies the IsOpen dependency property.
IsSelectablePropertyIdentifies the IsSelectable dependency property.
NavigateUriPropertyIdentifies the NavigationUri dependency property.
PreferredHorizontalDirectionPropertyIdentifies the PreferredPosition dependency property.
PreferredPositionPropertyIdentifies the PreferredPosition dependency property.
PreferredVerticalDirectionPropertyIdentifies the PreferredVerticalDirection dependency property.
ShowLatencyPropertyIdentifies the ShowLatency dependency property.
SlideDirectionPropertyIdentifies the SlideDirection dependency property.
StaysOpenOnClickPropertyIdentifies the StaysOpenOnClick dependency property.
TargetNamePropertyIdentifies the TargetName dependency property.
UncheckedEventIdentifies the Unchecked routed event.
VerticalOffsetPropertyIdentifies the VerticalOffset dependency property.

Public Methods

AttachEventHandlers()Attach built-in event handlers to control templates. Call this method if necessary.
DetachedEventHandlers()Detach built-in event handlers from control templates. Call this method if necessary.
Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Hide()Hide the context menu.
InitializeTemplates()Initializes control templates.
OnApplyTemplate()Builds the visual tree for the UXMenuItem when a new template is applied.
Select()Select the item.
Unselect()Unselect the current menu item.

Protected Methods

ApplyBinding(DependencyObject, object)Applies item binding for each generated element.
ApplyStyle(DependencyObject, object)Applies style for container element generated for each item.
ChangeVisualState(bool)Change Visual State.
DoToggle()Do toggle.
GetContainerForItemOverride()Creates or identifies the element that is used to display the given item.
GoToCheckedState()Go to checked state.
GoToCheckedState(bool)Go to checked state.
GoToDisabledMouseOverState()Go to disabled state.
GoToDisabledMouseOverState(bool)Go to disabled state.
GoToPressedState()Go to pressed state.
GoToPressedState(bool)Go to pressed state.
GoToUncheckedState()Go to unchecked state.
GoToUncheckedState(bool)Go to unchecked state.
IsItemItsOwnContainerOverride(object)Determines if the specified item is (or is eligible to be) its own container.
OnChecked()Raises Checked event.
OnClicked(ISRoutedEventArgs)Raises Click event.
OnCommandChanged(ICommand, ICommand)Invoked when the Command dependency property is changed.
OnHeaderChanged(object, object)Called when the value of the Header property changes.
OnInitializeCommandDefault(ICommand)Invoked when the Command is initialized.
OnIsSelectedChanged(bool, bool) 
OnItemsChanged(NotifyCollectionChangedEventArgs)Called when the value of the System.Windows.Controls.ItemsControl.Items property changes.
OnLostMouseCapture(MouseEventArgs)Called before the System.Windows.UIElement.LostMouseCapture event occurs.
OnMenuItemClick()Called when the menu item is clicked.
OnMouseEnter(MouseEventArgs)Called before MouseEnter event occurs.
OnMouseLeave(MouseEventArgs)Called before the MouseLeave event occurs.
OnMouseLeftButtonDown(MouseButtonEventArgs)Called before the System.Windows.UIElement.MouseLeftButtonDown event occurs.
OnMouseLeftButtonUp(MouseButtonEventArgs)Called before the MouseLeftButtonUp event occurs.
OnMouseMove(MouseEventArgs)Called before the MouseMove event occurs.
OnUnchecked()Raises Unchecked event.
PrepareContainerForItemOverride(DependencyObject, object)Prepares the specified element to display the specified item.
RefreshOffset()Refresh offset.
TryNavigateCore()Called when the menu item is about to perform navigation based on specified URI.
UpdateCanExecute()Invalidates the CanExecute state of the command associated to this button.
UpdateCommandUIState()Updates the current state of the UI based on the associated Command.

Events

CheckedOccurs when item is checked.
ClickOccurs when item is clicked.
RepositionedOccurs when the popup is repositioned.
SubMenuClosedOccurs when the popup is closed.
SubMenuOpenedOccurs when the popup is closed.
UncheckedOccurs when item is unchecked.

Public Constructors

public UXMenuItem()

Initializes a new instance of the UXMenuItem class.

Public Properties

public Thickness BoundaryOffset { get; set; }

Gets or set the minimum boundary offset.

public double ClickLatency { get; set; }

Gets or sets the latency, in seconds, before the click action is executed.

public ICommand Command { get; set; }

Gets or sets the command to invoke when this button is clicked.

public NoExecuteBehavior CommandCannotExecute { get; set; }

Gets or sets the UI behavior when the associated Command cannot be executed.

public object CommandParameter { get; set; }

Gets or sets the parameter to pass to the Command property.

public UIElement CommandTarget { get; set; }

Gets or sets the element on which to raise the specified command.

public Grid ContentElement { get; }

Gets the content element.

public Thickness ContentMargin { get; set; }

Gets or sets the outer margin of content element.

public ContentPresenter ContentPresenter { get; }

Gets the content presenter.

public ImageSource DefaultCheckedImageSource { get; set; }

Gets or sets the checked image source.

public PopupAnimation DisplayAnimation { get; set; }

Gets or sets a value that determines the display animation.

public bool EnableFadeInAnimation { get; set; }

Gets or sets a value that determines whether the fade animation is enabled.

public bool EnableFadeOutAnimation { get; set; }

Gets or sets a value that determines whether the fade animation is enabled.

public string GroupName { get; set; }

Gets or sets the group name.

public PopupAnimation HideAnimation { get; set; }

Gets or sets a value that determines the hide animation.

public double HorizontalOffset { get; set; }

Gets or sets the distance between the left side of the Silverlight control and the left side of the popup.

public ImageSource Icon { get; set; }

Gets or sets the source for the image.

public DataTemplate IconTemplate { get; set; }

Gets or sets the template to apply to Icon element.

public double ImageHeight { get; set; }

Gets or sets the height of the image.

public Thickness ImageMargin { get; set; }

Gets or sets the margin of the image.

public Stretch ImageStretch { get; set; }

Gets or sets the image stretch mode.

public double ImageWidth { get; set; }

Gets or sets the width of the image.

public Visibility IndicatorVisibility { get; set; }

Gets or sets the visibility of indicator element.

public string InputGestureText { get; set; }

Gets or sets the input gesture text.

public bool IsCheckable { get; set; }

Gets or sets a value that determine whether the item is checkable.

public bool IsChecked { get; set; }

Gets or seta a value that determine whetehr the item is checked.

public bool IsEnabled { get; set; }

Gets or sets a value indicating whether the user can interact with the control.

public bool IsOpen { get; set; }

Gets or sets whether the popup is currently displaying on the screen.

public bool IsSelectable { get; set; }

Gets or sets a value that indicates whether the item is selectable.

public UXMenu MenuElement { get; }

Gets the menu element.

public Uri NavigateUri { get; set; }

Gets or sets the URI to navigate when this menu item is clicked.

public PopupHorizontalDirection PreferredHorizontalDirection { get; set; }

Gets or sets the preferred horizontal direction.

public PopupPosition PreferredPosition { get; set; }

Gets or sets the preferred pop up positions.

public PopupVerticalDirection PreferredVerticalDirection { get; set; }

Gets or sets the preferred vertical direction.

public Grid RootElement { get; }

Gets the root element.

public Direction SlideDirection { get; set; }

Gets or sets a value that determine the slide direction when slide animation is used.

public bool StaysOpenOnClick { get; set; }

Gets or sets a value that determines whether menu stays open when the item is clicked.

public string TargetName { get; set; }

Gets or sets the name of a target window or frame that will display the content specified by the NavigationUri property.

public double VerticalOffset { get; set; }

Gets or sets the distance between the top of the Silverlight control and the top of the popup.

Protected Properties

protected DispatcherTimer HideLatencyTimeout { get; }

Gets hide latency timeout.

protected ProductInfo Product { get; }

Product Info.

protected bool RequireUpdateCanExecute { get; set; }

Determines whether the command associated to this button require to be updated in the next call.

protected DispatcherTimer ShowLatencyTimeout { get; }

Gets show latency timeout.

Fields

public static readonly DependencyProperty BoundaryOffsetProperty

Identifies the BoundaryOffset dependency property.

public static readonly RoutedEvent CheckedEvent

Identifies the Checked routed event.

public static readonly RoutedEvent ClickEvent

Identifies the Click routed event.

public static readonly DependencyProperty ClickLatencyProperty

Identifies the BusyLatency dependency property.

public static readonly DependencyProperty CommandCannotExecuteProperty

Identifies the CommandCannotExecute dependency property.

public static readonly DependencyProperty CommandParameterProperty

Identifies the CommandParameter dependency property.

public static readonly DependencyProperty CommandProperty

Identifies the Command dependency property.

public static readonly DependencyProperty CommandTargetProperty

Identifies the CommandTarget dependency property.

public static readonly DependencyProperty ContentMarginProperty

Identifies the ContentMargin dependency property.

public static readonly DependencyProperty DefaultCheckedImageSourceProperty

Identifies the ImageSource dependency property.

public static readonly DependencyProperty DisplayAnimationProperty

Identifies the DisplayAnimation dependency property.

public static readonly DependencyProperty EnableFadeInAnimationProperty

Identifies the EnableFadeAnimation dependency property.

public static readonly DependencyProperty EnableFadeOutAnimationProperty

Identifies the EnableFadeAnimation dependency property.

public static readonly DependencyProperty GroupNameProperty

Identifies the GroupName dependency property.

public static readonly DependencyProperty HideAnimationProperty

Identifies the HideAnimation dependency property.

public static readonly DependencyProperty HorizontalOffsetProperty

Identifies the HorizontalOffset dependency property.

public static readonly DependencyProperty IconProperty

Identifies the ImageSource dependency property.

public static readonly DependencyProperty IconTemplateProperty

Identifies the IconTemplate dependency property.

public static readonly DependencyProperty ImageHeightProperty

Identifies the ImageHeight dependency property.

public static readonly DependencyProperty ImageMarginProperty

Identifies the ImageMargin dependency property.

public static readonly DependencyProperty ImageStretchProperty

Identifies the ImageStretch dependency property.

public static readonly DependencyProperty ImageWidthProperty

Identifies the ImageWidth dependency property.

public static readonly DependencyProperty IndicatorVisibilityProperty

Identifies the IndicatorVisibility dependency property.

public static readonly DependencyProperty InputGestureTextProperty

Identifies the InputGestureText dependency property.

public static readonly DependencyProperty IsCheckableProperty

Identifies the IsCheckable dependency property.

public static readonly DependencyProperty IsCheckedProperty

Identifies the IsChecked dependency property.

public static readonly DependencyProperty IsEnabledProperty

Identifies the IsEnabled dependency property.

public static readonly DependencyProperty IsOpenProperty

Identifies the IsOpen dependency property.

public static readonly DependencyProperty IsSelectableProperty

Identifies the IsSelectable dependency property.

public static readonly DependencyProperty NavigateUriProperty

Identifies the NavigationUri dependency property.

public static readonly DependencyProperty PreferredHorizontalDirectionProperty

Identifies the PreferredPosition dependency property.

public static readonly DependencyProperty PreferredPositionProperty

Identifies the PreferredPosition dependency property.

public static readonly DependencyProperty PreferredVerticalDirectionProperty

Identifies the PreferredVerticalDirection dependency property.

public static readonly DependencyProperty ShowLatencyProperty

Identifies the ShowLatency dependency property.

public static readonly DependencyProperty SlideDirectionProperty

Identifies the SlideDirection dependency property.

public static readonly DependencyProperty StaysOpenOnClickProperty

Identifies the StaysOpenOnClick dependency property.

public static readonly DependencyProperty TargetNameProperty

Identifies the TargetName dependency property.

public static readonly RoutedEvent UncheckedEvent

Identifies the Unchecked routed event.

public static readonly DependencyProperty VerticalOffsetProperty

Identifies the VerticalOffset dependency property.

Public Methods

public void AttachEventHandlers()

Attach built-in event handlers to control templates. Call this method if necessary.

public void DetachedEventHandlers()

Detach built-in event handlers from control templates. Call this method if necessary.

public void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Hide()

Hide the context menu.

public void InitializeTemplates()

Initializes control templates.

public void OnApplyTemplate()

Builds the visual tree for the UXMenuItem when a new template is applied.

public void Select()

Select the item.

public void Unselect()

Unselect the current menu item.

Protected Methods

protected void ApplyBinding(DependencyObject element, object item)

Applies item binding for each generated element.

Parameters

elementContainer element.
itemItem.

 

protected void ApplyStyle(DependencyObject element, object item)

Applies style for container element generated for each item.

Parameters

elementContainer element.
itemItem.

 

protected void ChangeVisualState(bool useTransitions)

Change Visual State.

Parameters

useTransitionsUse transitions.

 

protected void DoToggle()

Do toggle.

protected DependencyObject GetContainerForItemOverride()

Creates or identifies the element that is used to display the given item.

Return Types

The element that is used to display the given item.

 

protected void GoToCheckedState()

Go to checked state.

protected void GoToCheckedState(bool animate)

Go to checked state.

Parameters

animateUse transitions.

 

protected void GoToDisabledMouseOverState()

Go to disabled state.

protected void GoToDisabledMouseOverState(bool animate)

Go to disabled state.

Parameters

animateUse transitions.

 

protected void GoToPressedState()

Go to pressed state.

protected void GoToPressedState(bool animate)

Go to pressed state.

Parameters

animateUse transitions.

 

protected void GoToUncheckedState()

Go to unchecked state.

protected void GoToUncheckedState(bool animate)

Go to unchecked state.

Parameters

animateUse transitions.

 

protected bool IsItemItsOwnContainerOverride(object item)

Determines if the specified item is (or is eligible to be) its own container.

Parameters

itemThe item to check.

Return Types

true if the item is (or is eligible to be) its own container; otherwise, false.

 

protected void OnChecked()

Raises Checked event.

protected void OnClicked(ISRoutedEventArgs eventArgs)

Raises Click event.

Parameters

eventArgs 

 

protected void OnCommandChanged(ICommand oldCommand, ICommand newCommand)

Invoked when the Command dependency property is changed.

Parameters

oldCommandThe old command.
newCommandThe new command.

 

protected void OnHeaderChanged(object oldHeader, object newHeader)

Called when the value of the Header property changes.

Parameters

oldHeaderThe old value of the Header property.
newHeaderThe new value of the Header property.

 

protected void OnInitializeCommandDefault(ICommand command)

Invoked when the Command is initialized.

Parameters

commandThe command to be initialized.

 

protected void OnIsSelectedChanged(bool oldValue, bool newValue)

 

Parameters

oldValue 
newValue 

 

protected void OnItemsChanged(NotifyCollectionChangedEventArgs e)

Called when the value of the System.Windows.Controls.ItemsControl.Items property changes.

Parameters

eNotifyCollectionChangedEventArgs that contains the event data

 

protected void OnLostMouseCapture(MouseEventArgs e)

Called before the System.Windows.UIElement.LostMouseCapture event occurs.

Parameters

eThe data for the event.

 

protected void OnMenuItemClick()

Called when the menu item is clicked.

protected void OnMouseEnter(MouseEventArgs e)

Called before MouseEnter event occurs.

Parameters

eThe data for the event.

 

protected void OnMouseLeave(MouseEventArgs e)

Called before the MouseLeave event occurs.

Parameters

eThe data for the event.

 

protected void OnMouseLeftButtonDown(MouseButtonEventArgs e)

Called before the System.Windows.UIElement.MouseLeftButtonDown event occurs.

Parameters

eThe data for the event.

 

protected void OnMouseLeftButtonUp(MouseButtonEventArgs e)

Called before the MouseLeftButtonUp event occurs.

Parameters

eThe data for the event.

 

protected void OnMouseMove(MouseEventArgs e)

Called before the MouseMove event occurs.

Parameters

eThe data for the event.

 

protected void OnUnchecked()

Raises Unchecked event.

protected void PrepareContainerForItemOverride(DependencyObject element, object item)

Prepares the specified element to display the specified item.

Parameters

elementThe container element used to display the specified item.
itemThe item to display.

 

protected void RefreshOffset()

Refresh offset.

protected bool TryNavigateCore()

Called when the menu item is about to perform navigation based on specified URI.

Return Types

True if the navigation succeed.

 

protected void UpdateCanExecute()

Invalidates the CanExecute state of the command associated to this button.

protected void UpdateCommandUIState()

Updates the current state of the UI based on the associated Command.

Events

public event ISRoutedEventHandler Checked

Occurs when item is checked.

public event ISRoutedEventHandler Click

Occurs when item is clicked.

public event UXPopupRoutedEventHandler Repositioned

Occurs when the popup is repositioned.

public event ISRoutedEventHandler SubMenuClosed

Occurs when the popup is closed.

public event ISRoutedEventHandler SubMenuOpened

Occurs when the popup is closed.

public event ISRoutedEventHandler Unchecked

Occurs when item is unchecked.

  • No labels