How to get button default style under windows 10? - wpf

Looking to my first steps with WPF on Windows 7 I was very pleased. Seeing it on Windows 10 I was very surprised. The buttons didn`t looks like expected. Trying it with WinForms results in the expected look an feel.
Here my problem:
So my question:
How can I get the "normal" style of the default button (OK has IsDefault=true) with the expanded blue border for the button even when it has focus, without defining the button-style myself?
This is very important in case of setting the focus to the Cancel-button programmatically, because in this case the dotted border will not be displayed, so on Win 10 the user can not know witch button will be pressed by enter.

You can get similar button styles using Windows UWP.
In WPF, you can check out the Modern UI(MUI) in MSDN site.
It can produce similar results. I have been working with mui for a couple of months and it really helped me to satisfy my client who wanted to have a Windows 10 like UI experience. I had to create tiles like in start menu also. MUI did a great job for me.
Get the MUI from Github. Modern UI for WPF
Also I had tried devexpress and telerik controls. Have a look at them too.

Related

Custom Title Bar Buttons in WPF

I'm completely new to WPF, and am currently learning how to use styles and templates. Today, I saw many projects that can tweak the title bar of the window. Most of them probably tweaked the window chrome to achieve that effect. However, I'm trying to create a title bar with Mac-like Close, Minimize and Maximize buttons. I want them rounded with 3-D Colored effects. I have scoured the internet for that style, but in vain. Could anyone tell me how to achieve that effect using WPF with VB.Net?
P.S. I am using VS2010, and don't have MS Blend.

WPF popup title bar coming alway in white background in Windows 10

Anyone have any idea how to change the messagebox title bar color to the default in windows 10 (looking for the default like in windows 8 or older). At present it is coming as white.
I am also searching for a solution. But I'm afraid that at the moment only UWP supports this feature. Not WPF.
What you could do is hiding the tilte bar and making a custom one.
Similar answer: https://stackoverflow.com/a/9978757/3319147

A window with no taskbar icon, no appearance in Alt-Tab and *without* using the ToolWindow extended style

I have a problem that appears to be new to Windows 10.
I want to create a form that is visible to the user, but with no task bar icon and that does not appear in Alt+Tab.
This is perfectly doable if one is happy to sacrifice the normal styling of a window by following the accepted solutions here for either WPF or Windows Forms.
The general advice for both WPF and Windows Forms is:
Set ShowInTaskbar to false
Enable the ToolWindow styling (either through setting the border style in WinForms or the WindowStyle in WPF)
However, this has a new, practical problem in Windows 10 when using Virtual Desktops: the moment you do the above, the WPF or WinForms window will appear in every virtual desktop. See my example application with a red background:
This affects both the Task View switching screen and the actual desktop itself. No matter where you go, the form is there!
Is there any way to show a form - or even just a bitmap - on Windows without anything appearing in the taskbar, without anything appearing in Alt+Tab and without duplicating the window on every virtual desktop?
I have spent two days researching every possible option, trying every example online, reading MSDN documentation on window styles etc. but all resort to the same method, either through P/Invoke calls or directly, but either way the result is the same.

How can I style the border and title bar of a window in WPF? [duplicate]

This question already has answers here:
How to create custom window chrome in wpf?
(5 answers)
Closed 6 months ago.
We are developing a WPF application which uses Telerik's suite of controls and everything works and looks fine. Unfortunately, we recently needed to replace the base class of all our dialogs, changing RadWindow by the standard WPF window (reason is irrelevant to this discussion). In doing so, we ended up having an application which still looked pretty on all developer's computers (Windows 7 with Aero enabled) but was ugly when used in our client's environment (Terminal Services under Windows Server 2008 R2).
Telerik's RadWindow is a standard user control that mimicks a dialog's behaviour so styling it was not an issue. With WPF's Window though, I have a hard time changing its "border". What I mean by "border" here is both the title bar with the icon and the 3 standard buttons (Minimize, Maximize/Restore, Close) and the resize grip around the window.
How can I change the looks of these items:
Title bar color
3 standard buttons
Window's real border color
With round corners if possible.
Those are "non-client" areas and are controlled by Windows. Here is the MSDN docs on the subject (the pertinent info is at the top).
Basically, you set your Window's WindowStyle="None", then build your own window interface. (similar question on SO)
You need to set
WindowStyle="None", AllowsTransparency="True" and optionally ResizeMode="NoResize"
and then set the Style property of the window to your custom window style, where you design the appearance of the window (title bar, buttons, border) to anything you want and display the window contents in a ContentPresenter.
This seems to be a good article on how you can achieve this, but there are many other articles on the internet.
I found a more straight forward solution from #DK comment in this question, the solution is written by Alex and described here with source,
To make customized window:
download the sample project here
edit the generic.xaml file to customize the layout.
enjoy :).
Such statements as “you can't because only Windows can control the non-client area” are not quite true — Windows lets you specify the dimensions of the non–client area.
The downside is this is only possible by calling Windows' kernel methods, and since you're in .NET, which is not native code, you'll need P/Invoke. (Remember, the whole of the Windows Form UI and console application I/O methods are offered as wrappers that make system calls under the hood.) Hence, as documented in MSDN, it is completely possible to use P/Invoke to access those methods that are needed to set up the non–client area.
Update: Simpler than ever!
As of .NET 4.5, you can just use the WindowChrome class to adjust the non-client area. Get started here and here, a guide to changing the window border dimensions. By setting it to 0, you'll be able to implement your custom window border in place of the system's one.
I suggest you to start from an existing solution and customize it to fit your needs, that's better than starting from scratch!
I was looking for the same thing and I fall on this open source solution, I hope it will help.

How to implement the standard Windows Phone 7 ComboBox replacement UI

I'm trying to implement what seems to be the standard UI replacement for comboboxes in Windows Phone 7. This is the TextBox + Navigate to New Page with Listbox approach you can see in the settings page of the Emulator.
I got the following issues while trying to implement this approach, speficically related to the TextBox:
If I use a ReadOnly TextBox the text appears in light gray, which is not really what I want. I want the normal black font there.
If I don't use a ReadOnly TextBox the virtual phone keyboard will appear in some rare situtations, even when I handled the MouseEnter event. I can't consistently reproduce the situations when the keyboard appears.
Which is the best approach to implement this behaviour?
The Windows Phone Toolkit has a ListPicker that is quite flexible and easy to use.
Have you considered just using a TextBlock with an invisible button over the top? Or associate a gesture to take the tap event?
You could also check out Alex's implementation here of a picker box.
Implementing Picker Box functionality on WP7. - Alex Yakhnin's Blog

Resources