StandaloneToolBar Class
Represents a standalone toolbar control that can host bar controls, and is a replacement for a native ToolBar.
[TemplatePart(Name = "PART_OverflowPanel", Type = typeof(StandaloneToolBarOverflowPanel))]
public class StandaloneToolBar : ItemsControl, IOverflowingItemsControl, IRootBarControl, IOrientedElement
- Inheritance:
- object Visual UIElement FrameworkElement Control ItemsControl object
- Implements:
- IOverflowingItemsControl IRootBarControl IOrientedElement
Constructors
StandaloneToolBar()
Initializes a new instance of the StandaloneToolBar class.
public StandaloneToolBar()
Properties
CornerRadius
Gets or sets the corner radius of the control's border.
public CornerRadius CornerRadius { get; set; }
Property Value
- CornerRadius:
The corner radius of the control's border.
HasShadow
Gets or sets whether the toolbar has a shadow.
public bool HasShadow { get; set; }
Property Value
- bool:
true
if the toolbar has a shadow; otherwise,false
.
IsOverflowed
Gets whether the toolbar is overflowed, which is when it isn't large enough to display all items.
public bool IsOverflowed { get; }
Property Value
- bool:
true
if the toolbar is overflowed; otherwise,false
.
ItemContainerTemplateSelector
Gets or sets the ItemContainerTemplateSelector that creates UI controls for bar control view models.
public ItemContainerTemplateSelector ItemContainerTemplateSelector { get; set; }
Property Value
- ItemContainerTemplateSelector:
The ItemContainerTemplateSelector that creates UI controls for bar control view models.
ItemSpacing
Gets or sets the amount of spacing between items.
public double ItemSpacing { get; set; }
Property Value
- double:
The amount of spacing between items. The default value is
1
.
Orientation
Gets or sets the orientation of the control.
public Orientation Orientation { get; set; }
Property Value
- Orientation:
The orientation of the control.
OverflowButtonToolTip
Gets the tooltip for the overflow button.
public object OverflowButtonToolTip { get; set; }
Property Value
- object:
The tooltip for the overflow button.
UserInterfaceDensity
Gets or sets a UserInterfaceDensity that indicates how compact or spacious the UI should appear.
public UserInterfaceDensity UserInterfaceDensity { get; set; }
Property Value
- UserInterfaceDensity:
A UserInterfaceDensity that indicates how compact or spacious the UI should appear. The default value is Compact.
Methods
ClearContainerForItemOverride(DependencyObject, object)
When overridden in a derived class, undoes the effects of the PrepareContainerForItemOverride(DependencyObject, object) method.
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameter | Type | Description |
---|---|---|
element | DependencyObject | The container element. |
item | object | The item. |
GetContainerForItemOverride()
Creates or identifies the element that is used to display the given item.
protected override DependencyObject GetContainerForItemOverride()
Returns
- DependencyObject:
The element that is used to display the given item.
IsItemItsOwnContainerOverride(object)
Determines if the specified item is (or is eligible to be) its own container.
protected override bool IsItemItsOwnContainerOverride(object item)
Parameter | Type | Description |
---|---|---|
item | object | The item to check. |
Returns
- bool:
true
if the item is (or is eligible to be) its own container; otherwise,false
.
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()
OnContextMenuOpening(ContextMenuEventArgs)
Invoked whenever an unhandled ContextMenuOpening routed event reaches this class in its route. Implement this method to add class handling for this event.
protected override void OnContextMenuOpening(ContextMenuEventArgs e)
Parameter | Type | Description |
---|---|---|
e | ContextMenuEventArgs | The RoutedEventArgs that contains the event data. |
OnCreateAutomationPeer()
Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
The type-specific AutomationPeer implementation.
OnMenuOpening(BarMenuEventArgs)
Occurs before a generated menu is opened, allowing for customization.
protected virtual void OnMenuOpening(BarMenuEventArgs e)
Parameter | Type | Description |
---|---|---|
e | BarMenuEventArgs | The BarMenuEventArgs that contains the event data. |
OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.PreviewGotKeyboardFocus attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyboardFocusChangedEventArgs | The KeyboardFocusChangedEventArgs that contains the event data. |
OpenContextMenuForElement(DependencyObject)
Opens a context menu for the specified System.Windows.DependencyObject.
public bool OpenContextMenuForElement(DependencyObject sourceObj)
Parameter | Type | Description |
---|---|---|
sourceObj | DependencyObject | The target System.Windows.DependencyObject. |
Returns
- bool:
true
if a context menu was opened; otherwise,false
.
PrepareContainerForItemOverride(DependencyObject, object)
Prepares the specified element to display the specified item.
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameter | Type | Description |
---|---|---|
element | DependencyObject | Element used to display the specified item. |
item | object | Specified item. |
ToString()
Returns the string representation of this object.
Events
MenuOpening
Occurs before a generated menu is opened, allowing for customization.
Fields
CornerRadiusProperty
Identifies the CornerRadius dependency property. This field is read-only.
public static readonly DependencyProperty CornerRadiusProperty
HasShadowProperty
Identifies the HasShadow dependency property. This field is read-only.
public static readonly DependencyProperty HasShadowProperty
IsOverflowedProperty
Identifies the IsOverflowed dependency property. This field is read-only.
public static readonly DependencyProperty IsOverflowedProperty
ItemContainerTemplateSelectorProperty
Identifies the ItemContainerTemplateSelector dependency property. This field is read-only.
public static readonly DependencyProperty ItemContainerTemplateSelectorProperty
ItemSpacingProperty
Identifies the ItemSpacing dependency property. This field is read-only.
public static readonly DependencyProperty ItemSpacingProperty
MenuOpeningEvent
Identifies the MenuOpening routed event. This field is read-only.
public static readonly RoutedEvent MenuOpeningEvent
OrientationProperty
Identifies the Orientation dependency property. This field is read-only.
public static readonly DependencyProperty OrientationProperty
OverflowButtonToolTipProperty
Identifies the OverflowButtonToolTip dependency property. This field is read-only.
public static readonly DependencyProperty OverflowButtonToolTipProperty
UserInterfaceDensityProperty
Identifies the UserInterfaceDensity dependency property. This field is read-only.
public static readonly DependencyProperty UserInterfaceDensityProperty