FlexToolBar
class
Provides
a container for a group of commands or controls.
Examples
The
following example shows how to create a FlexToolBar object.
public partial class MyToolBar : FlexToolBar
{
//
***** //
}
public partial class Window1 : LinsMDIWindow
{
public
Window1()
{
InitializeComponent();
//
Create a toolbar instance.
MyToolBar
myToolBar
= new MyToolBar();
//
Show the toolbar.
myToolBar.ShowToolBar(this,
null, null);
}
}
§
Constructors
1) public
FlexToolBar()
Remarks
Initialize
a new instance of FlexToolBar.
§
Members
1) public virtual Rect Bounds { get; }
Remarks
Retrieve
both the size and the location of the toolbar, in pixels, relative to its
parent.
2) public virtual Rect BoundsAtMDIFrame { get; }
Remarks
Retrieve
both the size and the location of the toolbar, in pixels, relative to MDI
frame.
3) public virtual FLEX_DOCKING_ALIGN FlexDock { get; set;
}
Remarks
Gets
or sets which control borders are docked to its parent control.
It can be one of the following values,
§
NONE:
The
control is not docked.
§
TOP:
The
control's top edge is docked to the top of its containing control.
§
BOTTOM:
The
control's bottom edge is docked to the bottom of its containing
control.
§
LEFT:
The
control's left edge is docked to the left edge of its containing
control.
§
RIGHT:
The
control's right edge is docked to the right edge of its containing
control.
4) public
virtual long ID { get; set; }
Remarks
Every
FlexToolBar 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 toolbar is created, it will never been
destroyed, and its layout will be persistent and customizable. You can always
use LinsUIWPFDockingManager.GetToolBarFromAllPlacesByID()
to retrieve its instance, once it is created.
5) public
FlexCollection<UIElement> Items {
get; set; }
Remarks
Gets
or sets all tool items.
6) public virtual bool NoAnimate { get; set; }
Remarks
Gets
or sets the animation ability of the toolbar.
7) public bool ShowTitle { get; }
Remarks
This
member decides whether to show the title of the toolbar.
8) public bool ShowToolTip { get; set; }
Remarks
This
field decided if the tooltip will be shown, when the mouse hovers above one of
tool items, if the tool item has a tooltip assigned to it.
9) public string Text { get; set; }
Remarks
Gets
or sets the caption of the toolbar.
§
Methods
1) public virtual void
Close()
Remarks
This
closes the toolbar. If this toolbar is non-persistent (ID is larger than
10,000,000), the toolbar will be destroyed.
2) public void EnsureVisible(
FlexToolBarBaseButton
visibleButton)
Parameters
visibleButton
Type:
FlexToolBarBaseButton
A
tool item.
Remarks
Move
the tool item, visibleButton, into
view area if it is outside the view area.
3) 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 toolbar.
4) public
virtual Size MeasureSize(
bool
bAddRemoveChildren,
FLEX_DOCKING_ALIGN
nDockStyle)
Parameters
bAddRemoveChildren
Type:
bool
True,
if the Add/Remove button will be displayed at the toolbar title
area.
nDockStyle
Type:
FLEX_DOCKING_ALIGN
The
dock style of the toolbar.
Remarks
This
calculates how much space the toolbar requires. If the user wants to customize
the toolbar, this method may need to be overridden by the user.
5) public
virtual bool ShowToolBar()
Remarks
This
makes the FlexToolBar object visible and adds the toolbar into the
mainframe of the application. The FlexDock attribute of the toolbar will decide
the attached border of the mainframe.
6) public
virtual bool ShowToolBar(
DependencyObject
parent,
Int?
nBand,
Int?
nBandIndex)
Parameters
parent
Type:
DependencyObject
The
toolbar is going to be added into this parent
container. The parent
object should be one of the following three types, LinsMDIFrame,
FlexDocument, or FlexPanel. If parent
is null,
it means that this toolbar will be added into LinsMDIFrame(mainframe).
nBand
Type:
int?
The
index of the row that the toolbar will be inserted. If nBand is null,
then this toolbar will be appended.
nBandIndex
Type:
int?
The
index of the column that the toolbar will be inserted. If nBandIndex
is null,
then this toolbar will be appended.
Remarks
This
makes the FlexToolBar object visible and adds the toolbar into the
parent
container. The FlexDock attribute of the toolbar will decide the attached border
of the parent
container.
§
Events
1) public
event DockStyleChangedEventHandler
DockStyleChanged
Remarks
This
event is fired when the FlexDock attribute of the toolbar has
changed.
2) public
event NotifyCollectionChangedEventHandler
VisualChildrenChanged
Remarks
This
event is fired when any tool item is added or removed from the
toolbar.
Demo
References:
Command,
Command Events,
Commands Manager,
Create a Command,
Create a ToolBar,
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