1
votes

I am having a trouble restoring floating tools in Avalondock. The app Im developing uses avalondock for document managements with a few tools. I usually use the tools on the 2nd monitor.

I use multiple monitors at work with 125% scaling on one and 100% scaling on the other. The main monitor is 4k monitor, the other is 2k monitor.

When i remote desktop the work pc with a single monitor (3440x1440) and ran the app, i noticed that the tools in 2nd monitors are not visible and i have no way to bring them back to main screen.

Avalondock's floating LayoutAnchorables are not treated as separate views. if any one knows how to make LayoutAnchorable as a separate windows view, that would be the best solution. But i could not find how to do it. I tried the following

if (args.Model.IsFloating)
{
    var left = (int)args.Model.FloatingLeft;
    var top = (int)args.Model.FloatingTop;
    var width = (int)args.Model.FloatingWidth;
    var height = (int)args.Model.FloatingHeight;
    var rect = new System.Drawing.Rectangle(left, top, width, height);
   var intersected = Screen.AllScreens.Any(p => p.WorkingArea.IntersectsWith(rect));
    if (!intersected)
    {                            
        //need to reposition
        args.Model.FloatingLeft = 0;
        args.Model.FloatingTop = 0;
    }
    //args.Model.FloatingTop;
}

System.Windows.SystemParameters.PrimaryScreenHeight 1440    double
System.Windows.SystemParameters.PrimaryScreenWidth  3440    double
System.Windows.SystemParameters.VirtualScreenHeight 1440    double
System.Windows.SystemParameters.VirtualScreenWidth  3440    double

args.Model.FloatingLeft 4133.6 double args.Model.FloatingTop 909.6 double

WorkingArea {X = 0 Y = 0 Width = 4300 Height = 1750} System.Drawing.Rectangle The problem is that the working area is scaled at 125%. This makes args.Model within the bounds of the main windows.

So i guess i can't use System.Windows.Forms.Screen info because i do not know which scaling the user will be using.

How do i get the real resolutions of the multiple monitors and positions and scaling?

1

1 Answers

0
votes

i found the answer myself.

I was able to make the floating windows owner to null. Apparently the dock's floatingwindow inherit from System.Windows.Window This is what i wanted from the beginning.

private void DockManager_LayoutUpdated(object sender, EventArgs e)
{
    foreach (var floatingWindow in dockManager.FloatingWindows)
    {
        if (floatingWindow.Owner != null)
        {
            floatingWindow.Owner = null;
        }
        floatingWindow.ShowInTaskbar = true;
    }
}