C# Class Microsoft.Phone.Controls.ContextMenu

Inheritance: MenuBase
显示文件 Open project: Kinnara/WPToolkit Class Usage Examples

Public Properties

Property Type Description
IsFadeEnabledProperty System.Windows.DependencyProperty
IsOpenProperty System.Windows.DependencyProperty
IsZoomEnabledProperty System.Windows.DependencyProperty
RegionOfInterestProperty System.Windows.DependencyProperty
VerticalOffsetProperty System.Windows.DependencyProperty

Private Properties

Property Type Description
AdjustContextMenuPositionForPortraitMode double
ChildMenuItemClicked void
ClosePopup void
FocusNextItem void
InitializePage void
InitializeRootVisual void
OnApplicationBarMirrorChanged void
OnApplicationBarMirrorChanged void
OnContextMenuOrRootVisualSizeChanged void
OnEventThatClosesContextMenu void
OnIsOpenChanged void
OnIsOpenChanged void
OnLayoutUpdated void
OnOverlayMouseButtonUp void
OnOwnerHold void
OnOwnerUnloaded void
OnPageBackKeyPress void
OnRootVisualManipulationCompleted void
OnStoryboardCompleted void
OnVerticalOffsetChanged void
OpenPopup void
PositionIsOnScreenRight bool
SafeTransformToVisual System.Windows.Media.GeneralTransform
SetDefaultStyle void
SetRenderTransform void
UpdateContextMenuPlacement void
UpdateVisualStates void

Public Methods

Method Description
ContextMenu ( ) : System

Initializes a new instance of the ContextMenu class.

OnApplyTemplate ( ) : void

Called when a new Template is applied.

Protected Methods

Method Description
OnClosed ( RoutedEventArgs e ) : void

Called when the Closed event occurs.

OnKeyDown ( System.Windows.Input.KeyEventArgs e ) : void

Responds to the KeyDown event.

OnMouseLeftButtonDown ( System.Windows.Input.MouseButtonEventArgs e ) : void

Called when the left mouse button is pressed.

OnOpened ( RoutedEventArgs e ) : void

Called when the Opened event occurs.

Private Methods

Method Description
AdjustContextMenuPositionForPortraitMode ( Rect bounds, double roiY, double roiHeight, bool &reversed ) : double

Adjust the position (Y) of ContextMenu for Portrait Mode.

ChildMenuItemClicked ( ) : void

Called when a child MenuItem is clicked.

ClosePopup ( ) : void

Closes the Popup.

FocusNextItem ( bool down ) : void

Sets focus to the next item in the ContextMenu.

InitializePage ( ) : void

Attaches the ContxtMenu's BackKeyPress handler to properly enfore dismissal on back key press.

InitializeRootVisual ( ) : void

Initialize the _rootVisual property (if possible and not already done).

OnApplicationBarMirrorChanged ( DependencyObject o, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Handles changes to the ApplicationBarMirror DependencyProperty.

OnApplicationBarMirrorChanged ( IApplicationBar oldValue, IApplicationBar newValue ) : void

Handles changes to the ApplicationBarMirror property.

OnContextMenuOrRootVisualSizeChanged ( object sender, System.Windows.SizeChangedEventArgs e ) : void

Handles the SizeChanged event for the ContextMenu or RootVisual.

OnEventThatClosesContextMenu ( object sender, EventArgs e ) : void

Handles an event which should close an open ContextMenu.

OnIsOpenChanged ( DependencyObject o, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Handles changes to the IsOpen DependencyProperty.

OnIsOpenChanged ( bool newValue ) : void

Handles changes to the IsOpen property.

OnLayoutUpdated ( object sender, EventArgs e ) : void

Handles the LayoutUpdated event to capture Application.Current.RootVisual.

OnOverlayMouseButtonUp ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void

Handles the MouseButtonUp events for the overlay.

OnOwnerHold ( object sender, System e ) : void

Handles the Hold event for the owning element.

OnOwnerUnloaded ( object sender, RoutedEventArgs e ) : void

Handles the Unloaded event of the Owner.

OnPageBackKeyPress ( object sender, CancelEventArgs e ) : void

Handles the BackKeyPress of the containing PhoneApplicationPage.

OnRootVisualManipulationCompleted ( object sender, System.Windows.Input.ManipulationCompletedEventArgs e ) : void

Handles the ManipulationCompleted event for the RootVisual.

OnStoryboardCompleted ( object sender, EventArgs e ) : void

Handles the Completed event of the opening Storyboard.

OnVerticalOffsetChanged ( DependencyObject o, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Handles changes to the VerticalOffset DependencyProperty.

OpenPopup ( Point position ) : void
PositionIsOnScreenRight ( double position ) : bool

Whether the position is on the right half of the screen. Only supports landscape mode. This is used to determine which side of the screen the context menu will display on.

SafeTransformToVisual ( UIElement element, UIElement visual ) : System.Windows.Media.GeneralTransform

Calls TransformToVisual on the specified element for the specified visual, suppressing the ArgumentException that can occur in some cases.

SetDefaultStyle ( ) : void

Set up the background and border default styles

SetRenderTransform ( ) : void
UpdateContextMenuPlacement ( ) : void

Updates the location and size of the Popup and overlay.

UpdateVisualStates ( bool useTransitions ) : void

Uses VisualStateManager to go to the appropriate visual state.

Method Details

ContextMenu() public method

Initializes a new instance of the ContextMenu class.
public ContextMenu ( ) : System
return System

OnApplyTemplate() public method

Called when a new Template is applied.
public OnApplyTemplate ( ) : void
return void

OnClosed() protected method

Called when the Closed event occurs.
protected OnClosed ( RoutedEventArgs e ) : void
e System.Windows.RoutedEventArgs Event arguments.
return void

OnKeyDown() protected method

Responds to the KeyDown event.
protected OnKeyDown ( System.Windows.Input.KeyEventArgs e ) : void
e System.Windows.Input.KeyEventArgs The event data for the KeyDown event.
return void

OnMouseLeftButtonDown() protected method

Called when the left mouse button is pressed.
protected OnMouseLeftButtonDown ( System.Windows.Input.MouseButtonEventArgs e ) : void
e System.Windows.Input.MouseButtonEventArgs The event data for the MouseLeftButtonDown event.
return void

OnOpened() protected method

Called when the Opened event occurs.
protected OnOpened ( RoutedEventArgs e ) : void
e System.Windows.RoutedEventArgs Event arguments.
return void

Property Details

IsFadeEnabledProperty public_oe static_oe property

Identifies the IsFadeEnabled dependency property.
public static DependencyProperty,System.Windows IsFadeEnabledProperty
return System.Windows.DependencyProperty

IsOpenProperty public_oe static_oe property

Identifies the IsOpen dependency property.
public static DependencyProperty,System.Windows IsOpenProperty
return System.Windows.DependencyProperty

IsZoomEnabledProperty public_oe static_oe property

Identifies the IsZoomEnabled dependency property.
public static DependencyProperty,System.Windows IsZoomEnabledProperty
return System.Windows.DependencyProperty

RegionOfInterestProperty public_oe static_oe property

Identifies the RegionOfInterest dependency property.
public static DependencyProperty,System.Windows RegionOfInterestProperty
return System.Windows.DependencyProperty

VerticalOffsetProperty public_oe static_oe property

Identifies the VerticalOffset dependency property.
public static DependencyProperty,System.Windows VerticalOffsetProperty
return System.Windows.DependencyProperty