StepUp
StepUp

Reputation: 38189

How to arrange dockingable views at the first start of the program. AvalonDock

At start of the program I always see my FeatureViewTemplate is shown at the right side within FileStatsViewTemplate like that: enter image description here

But I would like the arrange of areas to be in such order File Stats at the left side and the FeatureArea at the right side. Like that: enter image description here

How to do such arrange of FileStats and FeatureArea at the first start of the program (*when there is no "AvalonDock.config" file created by program *)? Is it possible?

Upvotes: 0

Views: 303

Answers (1)

mandyzhu7
mandyzhu7

Reputation: 81

One solution would be to add two LayoutAnchorablePane and one LayoutDocumentPane.

 <avalonDock:LayoutRoot>
    <avalonDock:LayoutPanel Orientation="Horizontal">
      <avalonDock:LayoutAnchorablePane Name="FirstAnchorablePane"/>
      <avalonDock:LayoutDocumentPane/>
      <avalonDock:LayoutAnchorablePane Name="SecondAnchorablePane"/>
    </avalonDock:LayoutPanel>
  </avalonDock:LayoutRoot>

Correspondingly in LayoutInitializer initialize the two anchorable panes with the corresponding content.

        var item = anchorableToShow.Content; 
        var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "SecondAnchorablePane");
        var firstPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "FirstAnchorablePane");
        if (toolsPane != null)
        {
            if(item is RecentFilesViewModel)
                toolsPane.Children.Add(anchorableToShow);
            if (item is FileStatsViewModel)
                firstPane.Children.Add(anchorableToShow);
            return true;
        }

But with only one LayoutAnchorablePane, maybe there is a way to do so. No idea at all, would be interesting to know too.

Upvotes: 1

Related Questions