PhilipRieck / WpfAppBar

WPF AppBar helper
134 stars 48 forks source link

Bug Fix. When you drag the window to the seconds screen, if you snap … #20

Closed Benji-Yarmand closed 6 years ago

Benji-Yarmand commented 8 years ago

When you drag the window to the seconds screen, if you snap it, it used to snap to the primary screen instead of current one.

damonwildercarr commented 7 years ago

There is a bug when you try to dock on the LEFT on a secondary monitor. Inside ABSetPos the dimension.X property is negative (which throws an exception). Top, Bottom and Right work fine:

var rect = new Rect(location, new Size(dimension.X, dimension.Y)); info.DockedSize = rect;

I was able to get around this by explicitly testing for <0 and setting the X to what I need as the width of the AppBar:

        // THIS IS A HACK TO GET THE LEFT DOCK WORKING ON THE SECOND MONITOR
        if (dimension.X < 0)
        {
            dimension.X = 150;
        }

        var rect = new Rect(location, new Size(dimension.X, dimension.Y));
        info.DockedSize = rect;

You might have a more elegant solution?

Thanks, Damon

thedewi commented 6 years ago

This commit (rebased) was merged as part of #26 so I think this PR can be closed.

PhilipRieck commented 6 years ago

closing, as it was part of #26