0

I have a DocumentContent (AvalonDock) which contains a textEditor. I want to add a toolbar to it at runtime. To do this I need to add a GridDefinition so that the first row has a fixed height (for the toolbar) and the rest of the document content should be filled by the texteditor.

I created a new Grid and added a row definition to it and added the child to it but I don't know how to attach this to the DocumentContent. I am not even sure if it is the right way to add the toolbar. Any suggestions ?

        Grid grid = new Grid();
        RowDefinition rowDefinition1 = new RowDefinition();
        rowDefinition1.Height = new GridLength(32);

        grid.RowDefinitions.Insert(0, rowDefinition1);
        grid.Children.Insert(0, new IsaDocToolbar());

PS: I forgot to mention that I use AvalonDock 1.3

Joe Korolewicz
  • 474
  • 4
  • 21
ssarangi
  • 602
  • 1
  • 10
  • 28

1 Answers1

0

Why are you doing this in code and not using XAML?

Here is the basic idea/concept using MVVM in XAML

Document content should be a grid with 2 rows 1st row for toolbar 2nd row for text editor

Visibility of the first row can be controlled using binding to a Boolean property and by using BoolToVisibilityConverter.

Hope this helps. I have been doing something similar (not on the document content) for the application. You can checkout my Wide project for a similar concept for toolbars for the window.