Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I setup the initial layout? #444

Open
softwareantics opened this issue Aug 4, 2023 · 0 comments
Open

How can I setup the initial layout? #444

softwareantics opened this issue Aug 4, 2023 · 0 comments

Comments

@softwareantics
Copy link

softwareantics commented Aug 4, 2023

I'm having a little trouble setting up my layout initializer following some of the examples and tutorials I've found online. Below is similar to how I'd like my layout to be:

image

However, this is how it's currently looking:

image

Below is how I'm implementing the BeforeInsertAnchorable method.

public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
    {
        if (anchorableToShow == null)
        {
            throw new ArgumentNullException(nameof(anchorableToShow));
        }

        if (destinationContainer != null && destinationContainer.FindParent<LayoutFloatingWindow>() != null)
        {
            return false;
        }

        anchorableToShow.CanShowOnHover = false;

        if (anchorableToShow.Content is IProjectExplorerToolViewModel or IConsoleToolViewModel)
        {
            var group = new LayoutAnchorGroup();
            group.Children.Add(anchorableToShow);
            layout.BottomSide.Children.Add(group);

            anchorableToShow.ToggleAutoHide();

            return true;
        }

        if (anchorableToShow.Content is ISceneHierarchyToolViewModel)
        {
            var group = new LayoutAnchorGroup();
            group.Children.Add(anchorableToShow);
            layout.LeftSide.Children.Add(group);

            anchorableToShow.ToggleAutoHide();

            return true;
        }

        if (anchorableToShow.Content is IPropertiesToolViewModel or IEntitySystemsToolViewModel)
        {
            var group = new LayoutAnchorGroup();
            group.Children.Add(anchorableToShow);
            layout.RightSide.Children.Add(group);

            anchorableToShow.ToggleAutoHide();

            return true;
        }

        return false;
    }

And here is my LayoutRoot

<!-- LAYOUT UPDATE STRATEGY -->
            <DockingManager.LayoutUpdateStrategy>
                <layout:LayoutInitializer />
            </DockingManager.LayoutUpdateStrategy>

            <!-- LAYOUT ROOT -->
            <LayoutRoot>
                <LayoutPanel Orientation="Horizontal">
                    <LayoutPanel Orientation="Vertical">

                        <!-- DOCUMENTS -->
                        <LayoutDocumentPane />
                    </LayoutPanel>

                    <LayoutAnchorablePaneGroup DockWidth="256" Orientation="Vertical">
                        <LayoutAnchorablePane Name="SceneHierarchy" />
                        <LayoutAnchorablePane Name="EntitySystems" />
                        <LayoutAnchorablePane Name="Properties" />
                    </LayoutAnchorablePaneGroup>

                    <LayoutAnchorablePaneGroup DockHeight="256" Orientation="Horizontal">
                        <LayoutAnchorablePane Name="ProjectExplorer" />
                        <LayoutAnchorablePane Name="Console" />
                    </LayoutAnchorablePaneGroup>
                </LayoutPanel>

If anyone can point me in the right direction that would be lovely. For now, I don't care much for saving/loading layouts and just want to have a layout similar to the first screenshot shown above.

I guess my issues are:

  1. How can I add an anchorable pane to another anchorable pane like in the first screenshot (see the project explorer and console tool windows).
  2. How can I resize the initial width and height of the tool windows and perhaps set a minimum and maximum?
  3. Also, is there a better way to ensure that anchorable panes are not automatically hidden when added to a group? This seems almost like a bug having to call ToggleAutoHide for each group.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant