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 to adjust FloatingHeight/Width to desiered size of Content? #140

Closed
eriove opened this issue Mar 27, 2020 · 4 comments
Closed

How to adjust FloatingHeight/Width to desiered size of Content? #140

eriove opened this issue Mar 27, 2020 · 4 comments

Comments

@eriove
Copy link
Contributor

eriove commented Mar 27, 2020

In some cases I know the minimum size the content of a LayoutAnchorable will need. In that case I have the following code when opening the window:

DockingManager manager;
view = // Some user control
anchorable = new LayoutAnchorable()
{
    Content = view,
    Floatingheight = view.MinHeight,
    FloatingWidth = view.MinWidth
};
anchorable.AddToLayout(manager, AnchorableShowStrategy.Most);
anchorable.Float()

This gives almost the correct behavior, depending on the size of the border and the title of the window the size gets a bit too small. Is there any easy way to find the size of the borders and title of the window, or would it be possible for LayoutAnchorable to respect the MinWidth and MinHeight of its Content?

The easiest solution is of course to just add two constants to take this into account, but then someone change the theme of the application and the constants would be hard to track down.

@eriove eriove changed the title Hot to adjust FloatingHeight/Width to desiered size of Content= How to adjust FloatingHeight/Width to desiered size of Content? Mar 27, 2020
@eriove
Copy link
Contributor Author

eriove commented Mar 30, 2020

I've dug through the templates and as I understand it is this margin and this MinHeight that creates the margins for a floating window. Hence the height should be increased by 16+3 and the width by 6 as a default in my example above.

Would it make sense to set the default FloatingHeight and FloatingWidth when undocking a window instead? My thinking is at that location it might be feasible to get the margins from the style. If you think it would be useful I can create a pull request.

@Dirkster99
Copy link
Owner

I think this could be useful if we can find a way to bind these values, but keep the current defaults in case there is no binding (eg. binding with FallBackValue) avalaible.

I would be very happy if you could create a Pull-Request for this change.

Ideally, we should adjust this for all themes to make this behavior as consistent as possible.
I can copy the XAML to other themes but it would obviously safe me a lot of extra time, if you were happy to do it :-)

Thanx for looking into this.

@eriove
Copy link
Contributor Author

eriove commented Mar 31, 2020

I'll see what I can do. Will most likely push something tomorrow

@Dirkster99
Copy link
Owner

See #146 for details of resolution.

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

2 participants