Inhaltsverzeichnis

API: Bars/Ribbon Controls

API Reference for menu bars, toolbars and ribbon.

TWvdSBarManager

Manager for menus and toolbars.

Namespace

WvdS.UI.Controls.Bars

PXAML

<BarManager>
  <BarManager.MainMenu>
    <Bar>
      <BarSubItem Caption="File">
        <BarButton Caption="New" Command="{Binding NewCommand}" Shortcut="Ctrl+N" />
        <BarButton Caption="Open" Command="{Binding OpenCommand}" Shortcut="Ctrl+O" />
        <BarSeparator />
        <BarButton Caption="Exit" Command="{Binding ExitCommand}" />
      </BarSubItem>
      <BarSubItem Caption="Edit">
        <BarButton Caption="Undo" Command="{Binding UndoCommand}" Shortcut="Ctrl+Z" />
        <BarButton Caption="Redo" Command="{Binding RedoCommand}" Shortcut="Ctrl+Y" />
      </BarSubItem>
    </Bar>
  </BarManager.MainMenu>
  <BarManager.Toolbars>
    <Bar Name="Standard">
      <BarButton Caption="New" Icon="new" Command="{Binding NewCommand}" />
      <BarButton Caption="Open" Icon="open" Command="{Binding OpenCommand}" />
      <BarButton Caption="Save" Icon="save" Command="{Binding SaveCommand}" />
    </Bar>
  </BarManager.Toolbars>
</BarManager>

Properties

Property Type Default Description
MainMenu TBar nil Main menu
Toolbars TBarCollection nil Toolbars
PopupMenus TPopupMenuCollection nil Context menus
AllowCustomization Boolean True Customization allowed

TWvdSRibbonControl

Microsoft Office-style Ribbon.

Namespace

WvdS.UI.Controls.Bars

PXAML

<RibbonControl ApplicationButtonText="File">
  <RibbonControl.ApplicationMenu>
    <RibbonApplicationMenu>
      <BarButton Caption="New" Icon="new" Command="{Binding NewCommand}" />
      <BarButton Caption="Open" Icon="open" Command="{Binding OpenCommand}" />
      <BarButton Caption="Save" Icon="save" Command="{Binding SaveCommand}" />
      <BarSeparator />
      <BarButton Caption="Exit" Command="{Binding ExitCommand}" />
    </RibbonApplicationMenu>
  </RibbonControl.ApplicationMenu>
 
  <RibbonPage Caption="Home">
    <RibbonGroup Caption="Clipboard">
      <BarButton Caption="Paste" Icon="paste" Size="Large" />
      <BarButton Caption="Cut" Icon="cut" />
      <BarButton Caption="Copy" Icon="copy" />
    </RibbonGroup>
    <RibbonGroup Caption="Font">
      <BarEditItem>
        <ComboBoxEdit Width="100" ItemsSource="{Binding Fonts}" />
      </BarEditItem>
      <BarButton Caption="Bold" Icon="bold" IsToggle="True" />
      <BarButton Caption="Italic" Icon="italic" IsToggle="True" />
    </RibbonGroup>
  </RibbonPage>
 
  <RibbonPage Caption="Insert">
    <RibbonGroup Caption="Tables">
      <BarButton Caption="Table" Icon="table" Size="Large" />
    </RibbonGroup>
  </RibbonPage>
</RibbonControl>

Properties

Property Type Default Description
Pages TRibbonPageCollection nil Ribbon pages
SelectedPage TRibbonPage nil Active page
ApplicationButtonText string | App button text | ^ ApplicationMenu | TRibbonApplicationMenu | nil | App menu | ^ QuickAccessToolbar | TBar | nil | Quick access | ^ IsMinimized | Boolean | False | Ribbon minimized | ^ Style | TRibbonStyle | rsOffice2019 | Office2007, Office2010, Office2013, Office2016, Office2019 | —- ===== TWvdSRibbonPage ===== Ribbon page (tab). ==== Namespace ==== WvdS.UI.Controls.Bars ==== Properties ==== | Property | Type | Default | Description | ^ Caption | string | Tab title
Groups TRibbonGroupCollection nil Groups
IsVisible Boolean True Visible
ContextualTabGroup string | Contextual tab | —- ===== TWvdSRibbonGroup ===== Ribbon group within a page. ==== Namespace ==== WvdS.UI.Controls.Bars ==== Properties ==== | Property | Type | Default | Description | ^ Caption | string | Group name
Items TBarItemCollection nil Contained items
ShowDialogLauncher Boolean False Dialog launcher
CollapsePriority Integer 0 Collapse priority

TWvdSBarButton

Toolbar/menu button.

Namespace

WvdS.UI.Controls.Bars

PXAML

<BarButton Caption="Save"
           Icon="save"
           Command="{Binding SaveCommand}"
           Shortcut="Ctrl+S"
           Hint="Save the current document" />

Properties

Property Type Default Description
Caption string | Button text | ^ Icon | TWvdSImageSource | nil | Icon | ^ Command | IWvdSCommand | nil | Command | ^ Shortcut | string | Keyboard shortcut
Hint string | Tooltip | ^ Size | TBarButtonSize | bsSmall | Small, Large | ^ IsToggle | Boolean | False | Toggle button | ^ IsPressed | Boolean | False | Toggle state | ^ IsEnabled | Boolean | True | Enabled | ==== Events ==== | Event | Signature | Description | ^ OnClick | TNotifyEvent | Button clicked | —- ===== TWvdSBarSubItem ===== Submenu. ==== Namespace ==== WvdS.UI.Controls.Bars ==== PXAML ==== <code xml> <BarSubItem Caption=„Recent Files“> <BarButton Caption=„Document1.txt“ /> <BarButton Caption=„Document2.txt“ /> <BarSeparator /> <BarButton Caption=„Clear Recent“ /> </BarSubItem> </code> ==== Properties ==== | Property | Type | Default | Description | ^ Caption | string | Menu text
Icon TWvdSImageSource nil Icon
Items TBarItemCollection nil Submenu items

TWvdSBarEditItem

Editor in toolbar/menu.

Namespace

WvdS.UI.Controls.Bars

PXAML

<BarEditItem Caption="Zoom:">
  <SpinEdit Value="{Binding ZoomLevel}"
            Minimum="25" Maximum="400"
            Width="80" />
</BarEditItem>

Properties

Property Type Default Description
Caption string

PXAML

<DataGrid ContextMenu="{StaticResource GridContextMenu}" />
 
<PopupMenu x:Key="GridContextMenu">
  <BarButton Caption="Edit" Command="{Binding EditCommand}" />
  <BarButton Caption="Delete" Command="{Binding DeleteCommand}" />
  <BarSeparator />
  <BarSubItem Caption="Export">
    <BarButton Caption="Excel" Command="{Binding ExportExcel}" />
    <BarButton Caption="PDF" Command="{Binding ExportPdf}" />
  </BarSubItem>
</PopupMenu>

Properties

Property Type Default Description
Items TBarItemCollection nil Menu items

Methods

Method Description
ShowAt(x, y) Show menu at position
ShowAtCursor Show menu at cursor
Close Close menu

See Also