Xceed Toolkit Plus for WPF v5.1 Documentation
Xceed.Wpf.AvalonDock Assembly / Xceed.Wpf.AvalonDock.Layout Namespace / LayoutAnchorable Class
Members Example


In This Topic
    LayoutAnchorable Class
    In This Topic

    Represents an anchorable in the layout model.

    Syntax
    'Declaration
     
    <ContentPropertyAttribute("Content")>
    <TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)>
    <NameScopePropertyAttribute("NameScope", System.Windows.NameScope)>
    <SerializableAttribute()>
    Public Class LayoutAnchorable 
       Inherits LayoutContent
       Implements ILayoutElement 
    'Usage
     
    Dim instance As LayoutAnchorable
    [ContentProperty("Content")]
    [TypeDescriptionProvider(MS.Internal.ComponentModel.DependencyObjectProvider)]
    [NameScopeProperty("NameScope", System.Windows.NameScope)]
    [Serializable()]
    public class LayoutAnchorable : LayoutContent, ILayoutElement  
    Remarks

    An anchorable is typically the container of application controls and can be dragged away from its container pane (LayoutAnchorablePane) and repositioned into another pane. Anchorables are always contained in a pane, which can be either a LayoutAnchorablePane or a LayoutDocumentPane, whereas documents (class LayoutDocument) can only be contained in a LayoutDocumentPane.

    Anchorables can also be dragged to a border of the parent DockingManager, which causes them to appear above, below, to the left of, or to the right of all other anchorables or documents (except for autohide windows). They can also be left in a floating window (LayoutAnchorableFloatingWindow).

    Unlike documents, anchorables can autohide, where their content collapses to one side of the docking manager and is represented only by a tab (see LayoutAnchorSide and LayoutAnchorGroup).

    AvalonDock adheres to an MVVM design.

    The Model is represented by the classes contained in the Xceed.Wpf.AvalonDock.Layout namespace. The classes in this namespace are the layout elements in a layout model (for example LayoutAnchorable/LayoutDocument, LayoutAnchorablePane/LayoutDocumentPaneLayoutAnchorablePaneGroup/LayoutDocumentPaneGroup, etc.) that are used directly in XAML within a DockingManager to describe how the layout is composed.

    The View is represented by the classes contained in the Xceed.Wpf.AvalonDock.Controls namespace; these classes are a set of stylizable controls that show the user controls. The names of the view controls typically end with "Control" (for example, LayoutAnchorableControl is the view control, whereas LayoutAnchorable is the model element).

    The DockingManager uses various classes (such as the LayoutItem and its derived classes) to perform the role of the ViewModel, preparing the model to be consumed by the view.

    There is one and only one logical tree, which has the DockingManager as its root. Even if a control is placed in a different window (i.e., autohidden windows or floating windows), it always belong to the same logical tree below the DockingManager.

    Example
    The following shows how to set up several anchorables and documents, as well as autohidden anchorables on the left side of the DockingManager.
    <xcad:DockingManager Grid.Row="1" MaxHeight="425"
                         AllowMixedOrientation="True"
                         BorderBrush="Black"
                         BorderThickness="1">
      <xcad:DockingManager.DocumentHeaderTemplate>
        <DataTemplate>
          <StackPanel Orientation="Horizontal">
            <Image Source="{Binding IconSource}" Margin="0,0,4,0"/>
            <TextBlock Text="{Binding Title}" />
          </StackPanel>
        </DataTemplate>
      </xcad:DockingManager.DocumentHeaderTemplate>
      <xcad:LayoutRoot x:Name="_layoutRoot">
        <xcad:LayoutPanel Orientation="Horizontal">
          <xcad:LayoutAnchorablePane DockWidth="200">
            <xcad:LayoutAnchorable ContentId="properties" Title="Properties" CanHide="False" CanClose="False"
                                      AutoHideWidth="240"
                                   IconSource="../Images/property-blue.png">
              <xctk:PropertyGrid NameColumnWidth="110"
                 SelectedObject="{Binding ElementName=_layoutRoot, Path=LastFocusedDocument.Content}"/>
            </xcad:LayoutAnchorable>
          </xcad:LayoutAnchorablePane>
          <xcad:LayoutDocumentPaneGroup >
            <xcad:LayoutDocumentPane>
              <xcad:LayoutDocument ContentId="document1" Title="Document 1" IconSource="../Images/document.png" >
                <Button Content="Document 1 Content" HorizontalAlignment="Center" VerticalAlignment="Center"/>
              </xcad:LayoutDocument>
              <xcad:LayoutDocument ContentId="document2" Title="Document 2" IconSource="../Images/document.png">
                <TextBox Text="Document 2 Content" AcceptsReturn="True"/>
              </xcad:LayoutDocument>
            </xcad:LayoutDocumentPane>
          </xcad:LayoutDocumentPaneGroup >
          <xcad:LayoutAnchorablePaneGroup DockWidth="125">
            <xcad:LayoutAnchorablePane>
              <xcad:LayoutAnchorable ContentId="alarms" Title="Alarms" IconSource="../Images/alarm-clock-blue.png" >
                <ListBox>
                  <s:String>Alarm 1</s:String>
                  <s:String>Alarm 2</s:String>
                  <s:String>Alarm 3</s:String>
                </ListBox>
              </xcad:LayoutAnchorable>
              <xcad:LayoutAnchorable ContentId="journal" Title="Journal" >
                <RichTextBox>
                  <FlowDocument>
                    <Paragraph FontSize="14" FontFamily="Segoe">
                      This is the content of the Journal Pane.
                      <LineBreak/>
                      A
                      <Bold>RichTextBox</Bold> has been added here
                    </Paragraph>
                  </FlowDocument>
                </RichTextBox>
              </xcad:LayoutAnchorable>
            </xcad:LayoutAnchorablePane>
          </xcad:LayoutAnchorablePaneGroup>
        </xcad:LayoutPanel>
    
        <xcad:LayoutRoot.LeftSide>
          <xcad:LayoutAnchorSide>
            <xcad:LayoutAnchorGroup>
              <xcad:LayoutAnchorable Title="Agenda" ContentId="agenda" IconSource="../Images/address-book-open.png">
                <TextBlock Text="Agenda Content" Margin="10" FontSize="18" FontWeight="Black" TextWrapping="Wrap"/>
              </xcad:LayoutAnchorable>
              <xcad:LayoutAnchorable Title="Contacts" ContentId="contacts" IconSource="../Images/address-book--pencil.png" >
                <TextBlock Text="Contacts Content" Margin="10" FontSize="18" FontWeight="Black" TextWrapping="Wrap"/>
              </xcad:LayoutAnchorable>
            </xcad:LayoutAnchorGroup>
          </xcad:LayoutAnchorSide>
        </xcad:LayoutRoot.LeftSide>
      </xcad:LayoutRoot>
    </xcad:DockingManager>
    Inheritance Hierarchy

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.DependencyObject
             Xceed.Wpf.AvalonDock.Layout.LayoutElement
                Xceed.Wpf.AvalonDock.Layout.LayoutContent
                   Xceed.Wpf.AvalonDock.Layout.LayoutAnchorable

    Public Constructors
     NameDescription
    Public ConstructorInitializes a new instance of the LayoutAnchorable class.  
    Top
    Public Properties
     NameDescription
    Public PropertyGets or sets the height to use when auto-hidden anchorables are shown for the first time.  
    Public Property  
    Public PropertyGets or sets the width to use when auto-hidden anchorables are shown for the first time.  
    Public Property  
    Public PropertyGets or sets whether an anchorable can be autohidden.  
    Public PropertyGets or sets whether the content can be closed definitively (removed from the layout and not just hidden). By default, false. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets if the LayoutAnchorable can be docked as a LayoutDocument.  
    Public PropertyGets whether the content can be moved to a floating window. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public Property

    Gets or sets whether an anchorable can be hidden.

     
    Public PropertyGets or sets if the LayoutDocument/LayoutAnchorable can use the toggle pin button when placed in a LayoutDocumentPane. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the content of the LayoutContent instance. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public Property

    Gets or sets the ID of the content, which is used to identify the content during serialization/deserialization.

    (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public Property (Inherited from System.Windows.DependencyObject)
    Public Property (Inherited from System.Windows.Threading.DispatcherObject)
    Public PropertyGets or sets the height that will be initially used when the content is dragged and then displayed in a floating window. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the left edge of a floating window that will contain this content. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the top edge of a floating window that will contain this content. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the width that will be initially used when the content is dragged and then displayed in a floating window. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets the icon source of the content (displayed next on the tab). (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets whether the content is active. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets whether the anchorable is anchored to a border in an autohidden state.  
    Public Property

    Gets or sets a value indicating whether the LayoutDocument or LayoutAnchorable is enabled.

    (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets whether the content is in a floating window. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets if the LayoutAnchorable or LayoutDocument will appear over all other windows when floating. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets whether the anchorable can be hidden.  
    Public PropertyGets whether the content is the last focused document. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets whether a content element is maximized. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets if the LayoutDocument/LayoutAnchorable is currently pinned in a LayoutDocumentPane. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public Property (Inherited from System.Windows.DependencyObject)
    Public PropertyGets or sets whether a content element is selected. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets whether the anchorable is visible.  
    Public PropertyGets or sets the date and time of the last activation of the content. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the parent container of the element. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutElement)
    Public PropertyGets or sets the previous container of the content. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the ID of the previous container. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the index of the previous container. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the root of the element. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutElement)
    Public PropertyGets or sets the title of the content. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public PropertyGets or sets the tooltip of the content. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Top
    Public Methods
     NameDescription
    Public MethodAdd the anchorable to a DockingManager layout  
    Public MethodOverloaded.  (Inherited from System.Windows.DependencyObject)
    Public MethodOverridden.   
    Public Method (Inherited from System.Windows.DependencyObject)
    Public MethodCompares the content of the current instance with the content of the specified object. If it the content cannot be compared, the titles are compared. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public MethodRe-dock the content to its previous container (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public MethodDock the content as document (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public Method (Inherited from System.Windows.DependencyObject)
    Public MethodProgrammatically creates a floating window of the content. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public Method (Inherited from System.Windows.DependencyObject)
    Public Method (Inherited from System.Windows.DependencyObject)
    Public MethodReturns null. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public Method (Inherited from System.Windows.DependencyObject)
    Public MethodHide this content and add it to the ILayoutRoot.Hidden collection of parent root.  
    Public Method (Inherited from System.Windows.DependencyObject)
    Public Method (Inherited from System.Windows.DependencyObject)
    Public MethodOverridden. 

    Reads serialized layout information using the specified XmlReader.

     
    Public Method (Inherited from System.Windows.DependencyObject)
    Public MethodOverloaded.  (Inherited from System.Windows.DependencyObject)
    Public MethodShows the content if it was previously hidden.  
    Public MethodToggles autohide state.  
    Public MethodModifies the pin status of the LayoutDocument/LayoutAnchorable from unpinned to pinned (or vice-versa) in a LayoutDocumentPane. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public MethodOverridden. 

    Writes serialized layout information using the specified XmlWriter.

     
    Top
    Protected Methods
     NameDescription
    Protected MethodOverridden. 

    Docks the anchorable.

     
    Protected MethodCalled when the Closed event has been raised. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Protected MethodCalled when the Closing event has been raised. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Protected Method  
    Protected MethodHandles the Hiding event.  
    Protected MethodProvides derived classes an opportunity to handle changes to the IsActive property. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Protected MethodProvides derived classes an opportunity to handle changes to the IsSelected property. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Protected MethodOverridden. Called when Parent has changed.  
    Protected MethodProvides an opportunity to execute code before Parent changes. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Protected Method (Inherited from System.Windows.DependencyObject)
    Protected MethodProvides derived classes an opportunity to handle changes to the Root property. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutElement)
    Protected Method (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Protected MethodRaises the PropertyChanged event for the specified property name. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutElement)
    Protected MethodRaises the PropertyChanging event for the specified property name. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutElement)
    Protected Internal Method (Inherited from System.Windows.DependencyObject)
    Top
    Public Events
     NameDescription
    Public EventRaised when the content is closed (i.e., removed definitively from the layout). (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public EventRaised when the content is about to be closed (i.e. removed definitively from the layout). (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public Event  
    Public EventRaised when the anchorable has been hidden (usually by the end-user clicking on the "X" button).  
    Public EventRaised when the IsActive property has changed. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public EventRaised when the IsSelected property has changed. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Public EventRaised when the IsVisible property changes.  
    Public EventRaised when a property has changed. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutElement)
    Public EventRaised when a property is about to change. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutElement)
    Public EventRaised when a LayoutContent's pin is pinned or unpinned. (Inherited from Xceed.Wpf.AvalonDock.Layout.LayoutContent)
    Top
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also