2

I have an Xceed DockingManager that is bound to an observable collection of objects. The docking manager populates a dropdown button based on the number of objects within the observablecollection. While I can see that there are elements populating the dropdown contents there are no titles being displayed. Unlike the document headers I don't see a specific property to bind to for the dropdown. What property do I need to bind to in order to display the title of the document within the dropdown?

Layout documents with Titles and dropdown without

Here is what my current bindings look like in xaml

<xcad:DockingManager Grid.Row="1" Name="DockManager" DocumentsSource="{Binding InstrumentsCollectionView}" DocumentClosed="DockManager_DocumentClosed">
    <xcad:DockingManager.DocumentHeaderTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Content.Title}"></TextBlock>
        </DataTemplate>
    </xcad:DockingManager.DocumentHeaderTemplate>

    <xcad:LayoutRoot x:Name="_layoutRoot">
        <xcad:LayoutPanel Orientation="Horizontal">

            <xcad:LayoutDocumentPaneGroup x:Name="_instrumentLDPG">
                <xcad:LayoutDocumentPane x:Name="_instrumentLDP">
                </xcad:LayoutDocumentPane>
            </xcad:LayoutDocumentPaneGroup>
        </xcad:LayoutPanel>
    </xcad:LayoutRoot>
    
</xcad:DockingManager>

1 Answer 1

0

I couldn't find another property besides the DocumentHeader to bind to. In the code behind however what I did was check to see if a document was added and then bind that document Title to my object Title property at the same index within the observable collection.




        if (_instrumentLDP.ChildrenCount > numLayoutDocs)
        {
            var tvm = ((LayoutDocument)_instrumentLDP.Children[_instrumentLDP.Children.Count - 1]).Content as ViewModel;

            Binding myBinding = new Binding("Title");
            myBinding.Source = tvm;

            BindingOperations.SetBinding(_instrumentLDP.Children[_instrumentLDP.Children.Count - 1], LayoutDocument.TitleProperty, myBinding);
            numLayoutDocs = _instrumentLDP.ChildrenCount;
        }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.