Home Forums WPF controls Xceed Toolkit Plus for WPF LayoutAnchorable's property Content not binded once the panel is created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Marco83
    Post count: 6
    #44139 |

    It seems to me that binding of property Content of a LayoutAnchorable does not work.
    More precisely I’m trying to bind the Content as shown here:

    var group = new LayoutAnchorGroup();
    var layoutAnchorable = new LayoutAnchorable()
        Title = “MyAnchorable”,
        Content = new System.Windows.Controls.Button() { Content = “TESTING”, Margin = new Thickness(20) }
    group.Children.Add( layoutAnchorable );
    _layoutRoot.BottomSide.Children.Add( group ); //_layoutRoot is defined in XAML
    layoutAnchorable.AutoHideMinHeight = 100d; //MinHeight when pinned
    layoutAnchorable.IsActive = true; //to make it visible

    I can see the button only once I click on pinned picture and not before. The snippet above is inside the LayoutInizializer class in the method called BeforeInsertAnchorable. What is wrong in it?

    Thank you in advance.

    Fawzi [Xceed]
    Post count: 722


    We can’t see any binding in your code snipet.

    If your code-snipet is placed inside the MainWindow constructor, right after InitializeComponent(), it works fine : button is visible at startup.

    Here’s a code snipet showing how you can use BeforeInsertAnchorable method. When using the DockingManager.AnchorablesSource property, you are passing a list of what will become LayoutAnchorable’s content.

    <xcad:DockingManager x:Name=”_dockingManager”>
    <local:LayoutInitializer />
    <xcad:LayoutRoot x:Name=”_layoutRoot”>
    <xcad:LayoutPanel Orientation=”Horizontal”>
    <xcad:LayoutAnchorablePane DockWidth=”200″>
    <xcad:LayoutAnchorable ContentId=”properties”
    <xctk:PropertyGrid NameColumnWidth=”110″
    SelectedObject=”{Binding ElementName=_layoutRoot, Path=LastFocusedDocument.Content}”
    <xctk:PropertyDefinition TargetProperties=”Background” />
    <xctk:PropertyDefinition TargetProperties=”BorderBrush” />
    <xctk:PropertyDefinition TargetProperties=”BorderThickness” />
    <xctk:PropertyDefinition TargetProperties=”FontSize” />
    <xctk:PropertyDefinition TargetProperties=”FontStyle” />
    <xctk:PropertyDefinition TargetProperties=”Width” />
    <xctk:PropertyDefinition TargetProperties=”Height” />
    <xcad:LayoutDocument ContentId=”document1″
    Title=”Document 1″>
    <Button Content=”Document 1 Content”
    VerticalAlignment=”Center” />
    <xcad:LayoutDocument ContentId=”document2″
    Title=”Document 2″>
    <TextBox Text=”Document 2 Content”
    AcceptsReturn=”True” />
    </xcad:LayoutDocumentPaneGroup >

    public partial class MainWindow : Window
    public MainWindow()
    Xceed.Wpf.Toolkit.Licenser.LicenseKey = “XXXXX-XXXXX-XXXXX-XXXX”;


    this.MyAnchorables = new List<UIElement>()
    new Button() { Content = “TESTING”, Margin = new Thickness( 20 ) }
    _dockingManager.AnchorablesSource = this.MyAnchorables;

    public IEnumerable<UIElement> MyAnchorables

    public class LayoutInitializer : ILayoutUpdateStrategy
    public void AfterInsertAnchorable( LayoutRoot layout, LayoutAnchorable anchorableShown )

    public void AfterInsertDocument( LayoutRoot layout, LayoutDocument anchorableShown )
    throw new NotImplementedException();

    public bool BeforeInsertAnchorable( LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer )
    var group = new LayoutAnchorGroup();
    group.Children.Add( anchorableToShow );
    layout.BottomSide.Children.Add( group );

    anchorableToShow.Title = “MyAnchorable”;
    anchorableToShow.AutoHideMinHeight = 100d; //MinHeight when pinned
    anchorableToShow.IsActive = true; //to make it visible

    return true;

    public bool BeforeInsertDocument( LayoutRoot layout, LayoutDocument anchorableToShow, ILayoutContainer destinationContainer )
    throw new NotImplementedException();

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.