Friday, February 13, 2015

FlexMenu

Download   Demonstration  Question?   Contact Us


FlexMenu class
Represents a Windows menu control that enables you to hierarchically organize elements associated with commands and event handlers.
Examples
The following example shows how to create a FlexMenu object.
public partial class MyMenu : FlexMenu
{
// ***** //
public partial class Window1 : LinsMDIWindow
{
public Window1()
{
InitializeComponent();

// Create a menu instance.
MainMenu = new MyMenu();
// Show the menu.
MainMenu.ShowMenu();
}
}

§  Constructors
1)  public FlexMenu()
Remarks
Initialize a new instance of FlexMenu
§  Members
1)  public virtual Rect Bounds { get; }
Remarks
Retrieve both the size and the location of the menu, in pixels, relative to its parent.
2)  public virtual Rect BoundsAtMDIFrame { get; }
Remarks
Retrieve both the size and the location of the menu, in pixels, relative to MDI frame.
3)  public virtual long ID { get; set; }               
Remarks
Every FlexMenu object should have a unique ID. If the user does not assign a number to the ID, a unique number which is larger than FlexConstants.m_nUserDefinedControlStartID (10,000,000) will be automatically generated and assigned to it. If the ID is between FlexConstants.m_nUserDefinedControlStartID (1000) and FlexConstants.m_nUserDefinedControlStartID (10,000,000), then once the menu is created, it will never been destroyed, and its layout will be persistent and customizable. You can always use LinsUIWPFDockingManager.GetMenuFromAllPlacesByID() to retrieve its instance, once it is created.
4)  public FlexCollection<UIElement> Items { get; set; }               
Remarks
Gets or sets all menu items.
5)  public bool ShowToolTip { get; set; }
Remarks
This field decided if the tooltip will be shown, when the mouse hovers above one of the menu items, if the menu item has a tooltip assigned to it.
6)  public string Text { get; set; }
Remarks
Gets or sets the caption of the menu.
§  Methods
1)  public void EnsureVisible(
FlexToolBarBaseButton visibleButton)      
Parameters
visibleButton
Type: FlexToolBarBaseButton
A menu item.            
Remarks
Move the menu item, visibleButton, into view area if it is outside the view area.
2)  public virtual bool HitTest(
Point ptMousePosAtMDIFrame)                 
Parameters
ptMousePosAtMDIFrame
Type: Point
A location which is in MDI Frame coordinate. 
Remarks
Test whether the point, ptMousePosAtMDIFrame, which is in MDI Frame coordinate, is inside this menu.
3)  public virtual Size MeasureSize()              
Remarks
This calculates how much space the menu requires. If the user wants to customize the menu, this method may need to be overridden by the user.
4)  public virtual bool ShowMenu()              
Remarks
This make the FlexMenu object visible. 
§  Events
1)     public event NotifyCollectionChangedEventHandler VisualChildrenChanged              
Remarks
This event is fired when any menu item is added or removed from the menu.  



References:
Command,
Command Events,
Commands Manager,
Create a Command,
Create a Menu,
Dynamically Link a Tool Item to a Command Existed in an Optional Assembly,
Features,
How To,
Index,
Instruction,
LinsUIWPFDockingManager,
Tool Items Manager

No comments:

Post a Comment