Class ToolBar
Helper class for creating and managing toolbar controls.
public class ToolBar
- Inheritance
-
ToolBar
- Inherited Members
- Extension Methods
Constructors
ToolBar()
Initializes a new instance of the ToolBar class.
public ToolBar()
Fields
fPanel
The panel hosting toolbar controls.
protected StackPanel fPanel
Field Value
- StackPanel
Properties
Container
Gets the toolbar container.
public virtual Border Container { get; }
Property Value
- Border
IsVisible
Gets or sets the toolbar visibility.
public bool IsVisible { get; set; }
Property Value
Panel
Gets or sets the panel hosting toolbar controls.
public virtual StackPanel Panel { get; set; }
Property Value
- StackPanel
Methods
Add(Command)
Adds a command button to the toolbar.
public Button Add(Command Cmd)
Parameters
CmdCommandThe command.
Returns
- Button
The created button.
AddButton()
Adds a button to the toolbar.
public Button AddButton()
Returns
- Button
The created button.
AddButton(string)
Adds a button to the toolbar.
public Button AddButton(string ImageFileName)
Parameters
ImageFileNamestringThe image file name.
Returns
- Button
The created button.
AddButton(string, string, Action)
Adds a button to the toolbar.
public Button AddButton(string ImageFileName, string ToolTipText, Action Action)
Parameters
ImageFileNamestringThe image file name.
ToolTipTextstringThe tooltip text.
ActionActionThe click action.
Returns
- Button
The created button.
AddButton(string, string, EventHandler<RoutedEventArgs>)
Adds a button to the toolbar.
public Button AddButton(string ImageFileName, string ToolTipText, EventHandler<RoutedEventArgs> OnClick)
Parameters
ImageFileNamestringThe image file name.
ToolTipTextstringThe tooltip text.
OnClickEventHandler<RoutedEventArgs>The click event handler.
Returns
- Button
The created button.
AddButton(string, string, Func<Task>)
Adds a button to the toolbar.
public Button AddButton(string ImageFileName, string ToolTipText, Func<Task> Action)
Parameters
ImageFileNamestringThe image file name.
ToolTipTextstringThe tooltip text.
ActionFunc<Task>The asynchronous click action.
Returns
- Button
The created button.
AddCheckBox(string, bool?)
Adds a check box to the toolbar.
public CheckBox AddCheckBox(string Text = null, bool? IsChecked = null)
Parameters
Returns
- CheckBox
The created check box.
AddComboBox(IEnumerable, int, double)
Adds a combo box to the toolbar.
public ComboBox AddComboBox(IEnumerable ItemsSource = null, int ItemIndex = 0, double Width = NaN)
Parameters
ItemsSourceIEnumerableThe items source.
ItemIndexintThe selected item index.
WidthdoubleThe combo box width.
Returns
- ComboBox
The created combo box.
AddDropDownButton(string, string, ContextMenu, CancelEventHandler)
Adds a drop-down button to the toolbar.
public Button AddDropDownButton(string ImageFileName = null, string ToolTipText = null, ContextMenu Menu = null, CancelEventHandler OnOpening = null)
Parameters
ImageFileNamestringThe image file name.
ToolTipTextstringThe tooltip text.
MenuContextMenuThe context menu.
OnOpeningCancelEventHandlerThe menu opening handler.
Returns
- Button
The created button.
AddLabel(string)
Adds a label to the toolbar.
public Label AddLabel(string Text = null)
Parameters
TextstringThe label text.
Returns
- Label
The created label.
AddRange(IEnumerable<Command>)
Adds command buttons to the toolbar.
public void AddRange(IEnumerable<Command> Commands)
Parameters
CommandsIEnumerable<Command>The commands.
AddSeparator(string)
Adds a separator to the toolbar.
public Border AddSeparator(string Name = null)
Parameters
NamestringThe separator name.
Returns
- Border
The created separator.
AddTextBlock(string)
Adds a text block to the toolbar.
public TextBlock AddTextBlock(string Text = null)
Parameters
TextstringThe text.
Returns
- TextBlock
The created text block.
AddTextBox(string, double)
Adds a text box to the toolbar.
public TextBox AddTextBox(string Text = null, double Width = NaN)
Parameters
Returns
- TextBox
The created text box.
AddToggleButton(string, string, Action)
Adds a toggle button to the toolbar.
public ToggleButton AddToggleButton(string ImageFileName, string ToolTipText, Action Action)
Parameters
ImageFileNamestringThe image file name.
ToolTipTextstringThe tooltip text.
ActionActionThe checked changed action.
Returns
- ToggleButton
The created toggle button.
AddToggleButton(string, string, EventHandler<RoutedEventArgs>)
Adds a toggle button to the toolbar.
public ToggleButton AddToggleButton(string ImageFileName = null, string ToolTipText = null, EventHandler<RoutedEventArgs> OnCheckedChanged = null)
Parameters
ImageFileNamestringThe image file name.
ToolTipTextstringThe tooltip text.
OnCheckedChangedEventHandler<RoutedEventArgs>The checked changed event handler.
Returns
- ToggleButton
The created toggle button.
GetButtons()
Returns all toolbar buttons.
public Button[] GetButtons()
Returns
- Button[]
The toolbar buttons.
GetControls()
Returns all toolbar controls.
public Control[] GetControls()
Returns
- Control[]
The toolbar controls.
PanelChanged()
Called after the panel changes.
protected virtual void PanelChanged()
PanelChanging()
Called before the panel changes.
protected virtual void PanelChanging()
PlaceControlAfter(Control, Control)
Places a toolbar control after another toolbar control.
public void PlaceControlAfter(Control PivotItem, Control Item)
Parameters
PivotItemControlThe pivot control.
ItemControlThe control to move.
PlaceControlBefore(Control, Control)
Places a toolbar control before another toolbar control.
public void PlaceControlBefore(Control PivotItem, Control Item)
Parameters
PivotItemControlThe pivot control.
ItemControlThe control to move.
PlaceSeparatorAfter(Control, Border)
Places a separator after a toolbar control.
public void PlaceSeparatorAfter(Control PivotItem, Border Separator)
Parameters
PivotItemControlThe pivot control.
SeparatorBorderThe separator to move.
PlaceSeparatorBefore(Control, Border)
Places a separator before a toolbar control.
public void PlaceSeparatorBefore(Control PivotItem, Border Separator)
Parameters
PivotItemControlThe pivot control.
SeparatorBorderThe separator to move.
RemoveAll()
Removes all toolbar controls.
public virtual void RemoveAll()
RemovedAll()
Called after all toolbar controls are removed.
protected virtual void RemovedAll()
RemovingAll()
Called before all toolbar controls are removed.
protected virtual void RemovingAll()
SetupButton(Button, string, string)
Configures a toolbar button.
protected virtual void SetupButton(Button Button, string ImageFileName = null, string ToolTipText = null)