Bar

BarDockInfo Class

Contains information on the dock position of a bar.

Namespace: DevExpress.Xpf.Bars

Assembly: DevExpress.Xpf.Core.v20.1.dll

Declaration

public class BarDockInfo :
    DependencyObject
Public Class BarDockInfo
    Inherits DependencyObject

Related API Members

The following members accept/return BarDockInfo objects:

Remarks

A bar can be docked to a form by binding it to a specific bar container via the Bar.DockInfo property. To bind the bar to a bar container, use the BarDockInfo.ContainerType, BarDockInfo.Container or BarDockInfo.ContainerName property. When using these properties, ensure that the required bar container exists. See BarContainerControl to learn more.

To make a bar floating, set the BarDockInfo.ContainerType property to Floating.

Example

This example shows how to get and focus an editor embedded into a bar.In the example bars are added to BarContainers that are automatically created by setting the BarManager.CreateStandardLayout property to True.

<!--Set CreateStandardLayout to True  to create four BarContainers 
at the top, left, right, and bottom edges-->
<dxb:BarManager CreateStandardLayout="True" Margin="12" Name="barManager1">
    <dxb:BarManager.Items>
        <dxb:BarButtonItem x:Name="btn" Content="button" ItemClick="btn_ItemClick" />
        <dxb:BarEditItem x:Name="beiEditor" EditValue="text">
            <dxb:BarEditItem.EditSettings>
                <dxe:TextEditSettings></dxe:TextEditSettings>
            </dxb:BarEditItem.EditSettings>
        </dxb:BarEditItem>
    </dxb:BarManager.Items>

    <dxb:BarManager.Bars>
        <dxb:Bar x:Name="topBar" Caption="Top Bar">
            <!--Display the bar within the top BarContainer-->
            <dxb:Bar.DockInfo>
                <dxb:BarDockInfo ContainerType="Top" />
            </dxb:Bar.DockInfo>
            <dxb:Bar.ItemLinks>
                <dxb:BarButtonItemLink BarItemName="btn" />
                <dxb:BarEditItemLink BarItemName="beiEditor" />
            </dxb:Bar.ItemLinks>
        </dxb:Bar>
        <dxb:Bar x:Name="leftBar" Caption="Left Bar">
            <!--Display the bar within the left BarContainer-->
            <dxb:Bar.DockInfo>
                <dxb:BarDockInfo ContainerType="Left" />
            </dxb:Bar.DockInfo>
            <dxb:Bar.ItemLinks>
                <dxb:BarButtonItemLink BarItemName="btn" />                        
            </dxb:Bar.ItemLinks>
        </dxb:Bar>

    </dxb:BarManager.Bars>
    <RichTextBox></RichTextBox>
</dxb:BarManager> 
private void btn_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
    (beiEditor.Links[0] as BarEditItemLink).Editor.Focus();
} 

Example

This example shows how to manually create different types of bar containers: 1) A bar container used to display bars at the top of the window, 2) A float bar container (it's created automatically when setting the Bar.DockInfo.ContainerType property to Floating), 3) A standalone bar container that can be freely positioned within the window.

The following image shows the result:

E1553

<dxb:BarManager.Bars>
    <dxb:Bar x:Name="barFormat" Caption="Format">
        <dxb:Bar.DockInfo>
            <dxb:BarDockInfo ContainerType="Top" />
        </dxb:Bar.DockInfo>
        <dxb:Bar.ItemLinks>
            <dxb:BarCheckItemLink BarItemName="btnBold" />
            <dxb:BarCheckItemLink BarItemName="btnItalic" />
            <dxb:BarCheckItemLink BarItemName="btnUnderline" />
        </dxb:Bar.ItemLinks>
    </dxb:Bar>
    <!--Create a floating bar-->
    <dxb:Bar x:Name="barFont" Caption="Font">
        <dxb:Bar.DockInfo>
            <dxb:BarDockInfo ContainerType="Floating" FloatBarOffset="100,100" />
        </dxb:Bar.DockInfo>
        <dxb:Bar.ItemLinks>
            <dxb:BarButtonItemLink BarItemName="btnFont" />
        </dxb:Bar.ItemLinks>
    </dxb:Bar>
    <!--Create a bar displayed in the standalone container-->
    <dxb:Bar x:Name="barAlignment" Caption="Alignment">
        <dxb:Bar.DockInfo>
            <dxb:BarDockInfo ContainerName="StandaloneContainer" />
        </dxb:Bar.DockInfo>
        <dxb:Bar.ItemLinks>
            <dxb:BarCheckItemLink BarItemName="btnLeft" />
            <dxb:BarCheckItemLink BarItemName="btnCenter" />
            <dxb:BarCheckItemLink BarItemName="btnRight" />
            <dxb:BarCheckItemLink BarItemName="btnJustify" />
        </dxb:Bar.ItemLinks>
    </dxb:Bar>
</dxb:BarManager.Bars>
<!--Create containers to display bars-->
<DockPanel Name="dockPanel1" LastChildFill="False">
    <dxb:BarContainerControl x:Name="TopBarContainer"
                             ContainerType="Top"
                             DockPanel.Dock="Top" />
    <dxe:TextEdit Name="textBox"
                  Margin="8"
                  Width="300"
                  HorizontalAlignment="Left"
                  VerticalAlignment="Top"
                  DockPanel.Dock="Top"
                  EditValue="Sample text"
                  TextElement.FontSize="13" />
    <dxb:BarContainerControl x:Name="StandaloneContainer"
                             ContainerType="None"
                             DockPanel.Dock="Top"
                             Orientation="Horizontal" />
</DockPanel> 
See Also