WPF Grid + Splitter + FlowDocumentScrollViewer

63 views Asked by At

I have a WPF Grid with 4 rows:

Row 0 : Height = 1.0 (Grid Unit Type Star)

Row 1 - GridSplitter. Height GridLength.Auto

Row 2 - Height Fixed (About 20px)

Row 3 - FlowDocumentScrollViewer: Height GridLength.Auto

Row 1. 2, 3 are initially hidden (for this reasong height of row1 = 1.0). When clicking a button row 1, 2 and 3 are made visible.

I can't drag the splitter to make the flow document scroll viewer smaller. If I drag the splitter to make it bigger, the Row 2 grows but the row 3 keeps with the same height.

¿How can I get the row 3 growing or shrunking properly? I post my code below:

 void BuildComponents()
    {
        mainGrid= new Grid();


        RowDefinition row0 = new RowDefinition();
        RowDefinition splitterRow = new RowDefinition();
        RowDefinicion fixedHeightRow = new RowDefinition();
        RowDefinition scrolldocumentRow= new RowDefinition();

        row0.Height = new GridLength(1.0, GridUnitType.Star);
        splitterRow.Height = GridLength.Auto;
        fixedHeightRow .Height = new GridLength(20, GridUnitType.Pixel);
        scrolldocumentRow.Height = GridLength.Auto;

        mainGrid.RowDefinitions.Add(row0);
        mainGrid.RowDefinitions.Add(splitterRow);
        mainGrid.RowDefinitions.Add(fixedHeightRow );
        mainGrid.RowDefinitions.Add(scrolldocumentRow);


        mainGrid.Children.Add(/*Grid Panel */);
        mainGrid.Children.Add(Splitter);
        mainGrid.Children.Add(/* Panel */);
        mainGrid.Children.Add(/* Flow Document Scroll Viewer */);

Thank you

0

There are 0 answers