Table of Contents

Class ToolBar

Namespace
Tripous.Desktop
Assembly
Tripous.Desktop.dll

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

bool

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

Cmd Command

The 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

ImageFileName string

The 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

ImageFileName string

The image file name.

ToolTipText string

The tooltip text.

Action Action

The 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

ImageFileName string

The image file name.

ToolTipText string

The tooltip text.

OnClick EventHandler<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

ImageFileName string

The image file name.

ToolTipText string

The tooltip text.

Action Func<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

Text string

The check box text.

IsChecked bool?

The checked value.

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

ItemsSource IEnumerable

The items source.

ItemIndex int

The selected item index.

Width double

The 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

ImageFileName string

The image file name.

ToolTipText string

The tooltip text.

Menu ContextMenu

The context menu.

OnOpening CancelEventHandler

The menu opening handler.

Returns

Button

The created button.

AddLabel(string)

Adds a label to the toolbar.

public Label AddLabel(string Text = null)

Parameters

Text string

The label text.

Returns

Label

The created label.

AddRange(IEnumerable<Command>)

Adds command buttons to the toolbar.

public void AddRange(IEnumerable<Command> Commands)

Parameters

Commands IEnumerable<Command>

The commands.

AddSeparator(string)

Adds a separator to the toolbar.

public Border AddSeparator(string Name = null)

Parameters

Name string

The separator name.

Returns

Border

The created separator.

AddTextBlock(string)

Adds a text block to the toolbar.

public TextBlock AddTextBlock(string Text = null)

Parameters

Text string

The 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

Text string

The initial text.

Width double

The text box width.

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

ImageFileName string

The image file name.

ToolTipText string

The tooltip text.

Action Action

The 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

ImageFileName string

The image file name.

ToolTipText string

The tooltip text.

OnCheckedChanged EventHandler<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

PivotItem Control

The pivot control.

Item Control

The control to move.

PlaceControlBefore(Control, Control)

Places a toolbar control before another toolbar control.

public void PlaceControlBefore(Control PivotItem, Control Item)

Parameters

PivotItem Control

The pivot control.

Item Control

The control to move.

PlaceSeparatorAfter(Control, Border)

Places a separator after a toolbar control.

public void PlaceSeparatorAfter(Control PivotItem, Border Separator)

Parameters

PivotItem Control

The pivot control.

Separator Border

The separator to move.

PlaceSeparatorBefore(Control, Border)

Places a separator before a toolbar control.

public void PlaceSeparatorBefore(Control PivotItem, Border Separator)

Parameters

PivotItem Control

The pivot control.

Separator Border

The 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)

Parameters

Button Button

The button to configure.

ImageFileName string

The image file name.

ToolTipText string

The tooltip text.