Hide Taskbar on fullscreen WPF - wpf

recently i had tried to make task-bar invisible in maximize mode but unfortunately nothing worked.
i had some research over MSDN and stack overflow and most of them said make window border equal to none and maximize window.but it didn't worked.
BTW: i am using Metro-window and it has a hide task-bar functionality by itself.but it didn't worked either.

My experience on Windows 8.1 is that setting WindowStyle="None" WindowState="Maximized" (as most people say) is not enough.
To hide taskbar I had to set ResizeMode="NoResize"

Related

How to show hidden TaskBar if WPF application is maximized

If the auto-hide of Windows 10 TaskBar is ON then when the app is running will cover it and there is no way to get to the TaskBar with the mouse cursor. Any way to solve this?
mc:Ignorable="d" WindowState="Maximized" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
This is one of the biggest problems with the WindowChrome/WindowStyle="None" functionality in WPF. I don't know a 100% full proof way of handling it. The best way I've been able to find online is to use some interop to manually handle the Window's WndProc function and intercept the WM_GETMINMAXINFO message. This message controls the dimensions for a maximized window. Using this method, you can subtract a pixel or two from the maximized dimensions so that the taskbar can poke through.
Since the taskbar can be positioned in different corners of the screen, you can use some more interop to detect the current location of the taskbar. Like I said, this method doesn't work perfectly. Sometimes the taskbar gets stuck behind the window. Until someone posts a better method, it's the best I've been able to find. Here's a code sample (not mine) that I found on GitHub:
https://gist.github.com/MortenChristiansen/6463580

WPF Application doesn't fit into all the monitor screen

I have a WPF application that fits into my computer screen having screen resolution 1920 * 1080. But the same WPF application doesn't fit into my Microsoft Surface screen having same resolution 1920 * 1080. The exact issue is, it doesn't show the scroll bar in that little laptop. The issue is in the XAML for the page I am having trouble with and the window that hosts it. Any suggestion would be appreciated. Thanks.
The code is something like this right now.
<Page x:Class="form_Dock" Background="#FF19191E" MouseEnter="Page_MouseEnter"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ABC.UI" SnapsToDevicePixels="True">
This could be a scaling issue caused by WPF using device independent pixels to determine the size of the application. The Surface screen is pretty small, so there may be some scaling done in Windows to compensate, which is throwing the size of your window out.
You might be able to fix your problem by setting SnapsToDevicePixels on the window element to true:
https://msdn.microsoft.com/en-us/library/system.windows.uielement.snapstodevicepixels(v=vs.110).aspx
Also, this explains device independent pixels quite well:
https://wpf.2000things.com/2013/02/19/759-device-independent-units-dips/

Why are my Windows 8 WPF radio buttons all out of whack?

In Windows 8 RTM with VS2012 RTM I noticed my WPF app was giving me deformed radio buttons so I decided to create a sample to see if I was doing something wrong.
Here's the entire XAML App :
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" SizeToContent="WidthAndHeight">
<Grid>
<StackPanel Margin="20">
<RadioButton Content="Option 1" GroupName="1"/>
<RadioButton Content="Option 2" GroupName="2"/>
<RadioButton Content="Option 3" GroupName="3"/>
</StackPanel>
</Grid>
</Window>
Here I have the DPI settings set to 100%, which is actually NOT the default in Windows 8 (well at least for my 1920x1200 screen it isn't). You'll see the radio buttons are perfect.
This is the same exact application with DPI settings at 125% which is the default DPI for my screen resolution.
Here's 150%
You can see the inner circles aren't centered within the outer circle and it looks TERRIBLE. System applications with radio buttons are fine - but my WPF 4.5 app is not. Once again this sample app is 100% RTM bits and from scratch under Win 8.
Is it just all broken or is there a way to fix this (apart from insisting people put 100% DPI scaling).
Was really hoping Win8 would have gone a long way for high res screens and scaling issues like this, but something simple is badly broken out of the box :-(
Edit: filed connect bug https://connect.microsoft.com/VisualStudio/feedback/details/758368/radio-button-rendering-is-incorrect-on-windows-8-with-125-dpi-scaling-set
Edit: 8/29/12:
The WPF team has recently reviewed this issue and will not be
addressing this issue as at this time the team is focusing on the bugs
impacting the highest number of WPF developers. If you believe that
this was resolved in error, please reactivate this bug with any
necessary supporting details.
Everything in WPF is styled. In the case of the default system styles they sometimes, in my own experience, have little issues like this. A simple fix, to confirm it is the style and not the OS itself is to restyle the control yourself and see if that fixes it.
You can find the original style by looking at this question. These will help you rebuild and / or fix the issue
You could try put the stackpanel in a viewbox .. maybe

How to Detect a Right Click on Taskbar in WPF

I've got a WPF application in C# that starts off with a loading dialog. As expected, a button for the app shows up in the Windows taskbar.
I would like to detect right-clicks that might be done to that button.
Ultimately, I hope to disable the right-click or simply have the loading dialog regain focus. I've seen that some people use custom libraries and packages (interop, for example) to achieve some Win32 functionality, but I'd personally like to avoid this. Furthermore, these libraries/packages appear to be specific to Windows Forms; I've not seen anything for WPF. Is it impossible to manipulate the taskbar's right-click in WPF?
Can you not just set ShowInTaskbar="False" on the window?
You can set ShowInTaskbar="False" on the window, and then once you are done loading set it back to true in code-behind.

WPF transparent borders causes the UI to stop redrawing

As a follow up to my previous question, I am wondering how to use transparent windows correctly. If I have set my window to use transparency, the UI will occasionally appear to stop responding. What is actually happening is that the UI simply is not updating as it should. Animations do not occur, pages do not appear to navigate; however, if you watch the debugger clicking on buttons, links, etc.. do actually work. Minimizing and restoring the window "catches up" the UI again and the user can continue working until the behavior comes back.
If I remove the transparent borders, the behavior does not occur. Am I doing something wrong or is there some other setting, code, etc... that I need to implement to work with transparent borders properly?
Here is my window declaration for the code that fails.
<Window x:Class="MyProject.MainContainer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WPF APplication" Height="600" Width="800"
xmlns:egc="ControlLibrary" Background="{x:Null}"
BorderThickness="0"
AllowsTransparency="True"
MinHeight="300" MinWidth="400" WindowStyle="None" >
And the code that does not exhibit the behavior
<Window x:Class="MyProject.MainContainer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WPF Application" Height="600" Width="800"
xmlns:egc="ControlLibrary" Background="{x:Null}"
BorderThickness="0"
AllowsTransparency="False"
MinHeight="300" MinWidth="400" WindowStyle="None" >
Are you using .NET 3.0, or .NET 3.5 on Windows XP SP2? If so, this is a known problem with the transparent window API that has been fixed in .NET 3.5 and SP3 of XP (and I think SP1 of Vista). Basically when you set the AllowsTransparency to True, the WPF pipeline has to render in software only mode. This will cause a significant degradation in performance on most systems.
Unfortunately, the only thing you can do to fix this is to upgrade to .NET 3.0 SP1 (included in .NET 3.5), and install the appropriate service pack for Windows. Note that the transparent windows are still slower, but not nearly as bad. You can find a more in-depth discussion here.
I think that I've finally found a workaround. From everything I've read this problem should not be occurring with XP SP3 & .NET 3.5 SP1, but it is.
The example from this blog post shows how to use the Win32 API functions to create an irregular shaped window, which is what I"m doing. After reworking my main window to use these techniques, things seem to be working as expected and the behavior has not returned.
It is also of note that the reason the author recommends this method is due to performance issues with WPF and transparent windows. While I believe it may be better in .NET 3.5 SP1 that it was, this was not that hard to implement and should perform better.
I am running on Windows XP Pro SP3 and using .NET 3.5 SP1. I have also verified that the project is targeting version 3.5 of the framework.

Resources