PhilipRieck / WpfAppBar

WPF AppBar helper
133 stars 48 forks source link

Issue when Task Bar is not at Bottom or when any other App Bar is also present. #12

Closed birlaakhand closed 8 years ago

birlaakhand commented 8 years ago

Hey Phillip, I found this Issue with the code which leads into rendering Issues of the App in cases when the effective Workspace starting coordinates are not (0,0). I have already fixed it for me, but can't commit the code right now due to some system restrictions. The fix is as below:

under WpfAppBar.AppBarFunctions.ABSetPos, initialize barData.rc Values with SystemParameters.WorkArea values instead of set constants.

birlaakhand commented 8 years ago

Here's the exact code that can be used (Commented values are the old ones):

if (barData.uEdge == (int)ABEdge.Left || barData.uEdge == (int)ABEdge.Right) { barData.rc.top = (int)SystemParameters.WorkArea.Top; barData.rc.bottom = (int)SystemParameters.WorkArea.Bottom; //barData.rc.top = 0; //barData.rc.bottom = (int)screenSizeInPixels.Y; if (barData.uEdge == (int)ABEdge.Left) { barData.rc.left = (int)SystemParameters.WorkArea.Left; //barData.rc.left = 0; barData.rc.right = (int)Math.Round(sizeInPixels.X)+barData.rc.left; } else { barData.rc.right = (int)SystemParameters.WorkArea.Right; //barData.rc.right = (int)screenSizeInPixels.X; barData.rc.left = barData.rc.right - (int)Math.Round(sizeInPixels.X); } } else { barData.rc.left = (int)SystemParameters.WorkArea.Left; barData.rc.right = (int)SystemParameters.WorkArea.Right; //barData.rc.left = 0; //barData.rc.right = (int)screenSizeInPixels.X; if (barData.uEdge == (int)ABEdge.Top) { barData.rc.top = (int)SystemParameters.WorkArea.Top; //barData.rc.top = 0; barData.rc.bottom = (int)Math.Round(sizeInPixels.Y)+barData.rc.top; } else { barData.rc.bottom = (int)SystemParameters.WorkArea.Bottom; //barData.rc.bottom = (int)screenSizeInPixels.Y; barData.rc.top = barData.rc.bottom - (int)Math.Round(sizeInPixels.Y); }

PhilipRieck commented 8 years ago

Thanks. I've commited the changes and will push out a new Nuget package.

PhilipRieck commented 8 years ago

@danielchalmers I "fixed the fix" in 2489f84 by adding the docked window to the workarea. Apparently (timing?) on windows 10, getting the workarea was not including the area taken by the target window, while on earlier OS's it was.

Pushed as nuget package 1.5.0