philiprieck / wpfappbar Goto Github PK
View Code? Open in Web Editor NEWWPF AppBar helper
WPF AppBar helper
When the Windows Display Zoom is Set above 100% and you Set the Edge to the Right the AppBar will completely disappear off-screen.
I would just like to point out that this library could have been named AdmiralAppBar.
Nice work, though.
Hi, i've encountered problem using this library on win 8.1, docked to top.
The first bar is docked correctly, and the desktop size is shrinked without problems.
Starting with second bar, stange things happens, including: desktop not shrinking, overlapping bars, smaller bars.
The problem is Always reproducible on win 8.1 64; just create an empty window with a "quit" button and launch the same executable from bin/debug multiple times.
I was working on a library before finding this (d'oh!) and mine has the same problem, even if seems there are some differences.
I've read multiple times msdn article describing desktop appbar development, and all seems ok.
( https://msdn.microsoft.com/en-us/library/windows/desktop/cc144177(v=vs.85).aspx )
Any ideas? have you tried it on 8 / 8.1?
I'm trying to use this for an app I created at work, but I can't seem to get it to run.
When i use Windows RDP application or play video on youtube in full-screen mode, bar overlapp their.
Hello,
I tried setting the background property of the window or any other color related property but that doesn't seem to work. Do you have any idea how this can be achieved?
Best regards
Sascha
Hi @PhilipRieck ,
I've been using this library for over a year now and I've run into a few issues that we've corrected and I'm wondering if our pull request would be welcome.
Issues:
1 - When you make a window toggle back and forth between being an app bar, AddHook will be called called multiple times but the hook but the hook never gets removed.
2 - When sending the resize command, it uses BeginInvoke. This works fine when calling SetAppBar just once, but if you call it back-to-back you can get situations where things aren't executing in the order that you'd expect. We made SetAppBar async and awaited on Dispatcher.InvokeAsync and it worked fine.
Would a pull request containing the two fixes and changes above be welcome?
As you're probably aware, with Windows, highDPI is supported by implemented a screen scale (or text scale, for older versions of Windows). However, the calculation ends up being incorrect in such scenarios and the end result is that windows' partly end up behind the app bar.
Any suggestions on how screen scaling could be supported?
When exiting the application in a docked state, the docked area will be blocked for other applications. Is there a way to properly exit the app in a docked state?
(tested on Windows 10)
In AppBarFunctions.cs:137 you are assigning the return value of ABM_NEW
to ret
but not using it anywhere in the code:
var ret = Interop.SHAppBarMessage((int)Interop.ABMsg.ABM_NEW, ref abd);
Consider using ret
info.IsRegistered
to determine whether the registration succeeded and if not, omit ABSetPos()
(Which then would overlay other windows / bars)
The return value of SHAppBarMessage(ABM_NEW, ref pData)
is described in MSDN - ABM_NEW message:
Return value
Returns TRUE if successful, or FALSE if an error occurs or if the appbar is already registered.
Thanks for doing this :)
When docking bottom with visible Taskbar, it shrinks the height of the application by the Taskbar height. Do this multiple times (Dock down<->up) the application will shrink to 0
Windows 8.1
The window is not scaled properly when using non-96 dpi settings. There is a call to transform the working area to pixels, but the result is not used in the code.
My solution was to do this:
double dpiWidthFactor = toPixel.M11;
double dpiHeightFactor = toPixel.M22;
var actualWorkArea = GetActualWorkArea(info);
if (barData.uEdge == (int)ABEdge.Left || barData.uEdge == (int)ABEdge.Right)
{
barData.rc.top = (int)(actualWorkArea.Top * dpiHeightFactor);
barData.rc.bottom = (int)(actualWorkArea.Bottom * dpiHeightFactor);
etc.
So anywhere the working area was used, it is multiplied by the dpi factor.
I was try your helper class with some very basic empty project:
private void Form1_Shown(object sender, EventArgs e){
AppBarFunctions.SetAppBar(this, ABEdge.Right);
}
and I've got that error:
Error CS1503 Argument 1: cannot convert from 'Solution1.Form1' to 'System.Windows.Window'
I really can not understand where is the problem :( Why i can not use 'this' as argument here?
Hi there,
Sorry to use the Issues system but was not able to find another way to message you.
I have created a similar library for WinForms. This is based on yours and some other resources found online.
I have added a link back to your repo for WPF, perhaps you would like to do the same for WinForms?
https://github.com/tip2tail/t2tWinFormAppBarLib
Finally, thank you for your initial work - great library! ๐
Mark
Great work on this :)
Not sure if it's an issue or simply a wish/question.
Is it possible to put the app bar on the secondary screen?
It keeps putting it on the primary screen, any way to prevent/alter the destination screen?
๐
I've forked your repo in an effort to add auto hide support. I just cant get it to work. Ive tried ABM_SETAUTOHIDEBAR and ANM_SETATOHIDEBAREX, I do this right after your call to ABM_NEW.
There's very little written about this on the web, so its requiring trial and error, perhaps its because Im on Windows 10...
If you have any ideas or are able to get this working with your code, Id love to know.
app worked fine on standard resolution. But it crashed on micro soft surface with following error.
Exception:
Application: EPG-TickerApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
at System.Windows.Size..ctor(Double, Double)
at WpfAppBar.AppBarFunctions.ABSetPos(RegisterInfo, System.Windows.Window, System.Windows.FrameworkElement)
at WpfAppBar.AppBarFunctions.SetAppBar(System.Windows.Window, WpfAppBar.ABEdge, System.Windows.FrameworkElement, Boolean)
at EPG_TickerApp.MainWindow.MenuItem_Click_3(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs)
at System.Windows.Controls.MenuItem.InvokeClickAfterRender(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at System.Windows.Application.Run()
at EPG_TickerApp.App.Main()
Window will no longer stay on top of other windows after setting ABEdge to "None".
Tested with .NET 4.6.1 project on Windows 10 (Build 10586.104).
Since the release of dotnet core and .netstandard if you include this library then you get a compiler warning. If setting it up with .netstandard in the nuget package then this warning would disappear.
Hi Philip,
Could you publish an update to WPFAppBar that includes the changes I just committed in #24
One or more projects in the solution were not loaded correctly.
"
in Windows10 when docking on the right side, the space is reserved, but the window is not "docked" inside that space, but to the left of it, thus consuming double the width it should be.
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.
how we can add the feature of resizing in hight if dock on top or bottom.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.