Why doesn't WPF show Windows 8 style buttons in Windows 8 - c#

This is a Windows 8 style button:
And this is a button in .NET 4.5 WPF app:
Any ideas why WPF doesn't show the native Windows 8 style buttons? Is there a way to fix this?

What you can do is use a custom WPF styling from HERE.
Below is a screenshot of the styles as applied to the same WPF application in multiple states. The top is obviously Aero themed, and the bottom set is with the newly applied styles.
And here is a link to the XAML.

WPF does not use any native Windows controls - it comes with its own controls and styles for different Windows versions. On Windows 7 you can find the following assemblies
PresentationFramework.Aero.dll
PresentationFramework.Classic.dll
PresentationFramework.Luna.dll
PresentationFramework.Royale.dll
and I guess there is a new one for Windows 8. Because WPF is not build upon native controls it is possible to have a XP-style WPF application on Windows 7 and a Windows-7-style application on Windows XP.
If you want to match the native Windows 8 UI better than what WPF offers out of the box, you will have to create your own styles - probably based on the styles provided by WPF.

Related

Controls missing in UWP application

(I am new to UWP environment)
There are missing controls under the toolbox menu in VS 2022: I cannot find labels, tab controls and many other items I would use.
Thanks in advance
UWP does not support controls from WinForms WPF and other
Instead of a label, you could use a TextBlock.
This is the new UWP tabcontrol you could use:
https://learn.microsoft.com/en-us/windows/apps/design/controls/tab-view
You can also check out the WinUi 2 Gallery. Every UWP control is listed there: https://apps.microsoft.com/store/detail/winui-2-gallery/9MSVH128X2ZT
As #FrozenAssassine mentioned, UWP development is different from the traditional desktop app development. The controls are not the same as those you used to use before. The link he provides is really useful.
In addition to his answer, as you are new to UWP development, you could also go through this document: Develop UWP apps. This document could help you start the UWP development.

Tab Control In WinRT WINDOWS 8 C#

I am New To windows 8 App Development. I am creating one Windows Tablet Application in Visual studio express 2012 for windows 8. Is it possible to run this app to tablet because i am developing application in visual studio 2012 for windows 8???
I want to add Tab Control to my app like Windows Phone 7 & 8 supports pivot control like i have attached one image here. i want to add same controls in my app as image shown.
one tab control and into each tab there is another tab control. how can i add it to my app?? please help me
I'd recommend switching to Visual Studio Express 2013. 2012 should work for 8.0 though. There is no tab control in WinRT XAML. There is a grouped GridView or Hub control that serves similar purposes though. If you'd rather go with the more classic Zune Software-like tabbed interface - you should put a bunch of restyled RadioButtons in a horizontally oriented StackPanel like here and a few overlaid Grids underneath, then switch visibility of these panels based on the checked RadioButton.

Message Box in Metro Style XP, W7 and W8

Let's get straight to the point, a time'm implementing a Message Box in Metro Style with Windows Forms and C #
implementation was cool, but I'm having problems with semi transparent background on windows XP, use the method:
this.BackColor = Color.FromArgb (0x46, 0x69, 0x69, 0x69);
This model worked perfectly on windows 7 and 8 on XP but not also renders simply ignores the parameter Alpha. and beyond it depending on the system model theme he does not respond to Alpha too.
Even after searching I did not find something that really works perfectly in this Annex I developed a model based on other examples, to work on Windows XP, 7 and 8, the background is semi transparent independent of themes but does not render the controls inside the form of message simply ignores all content.
Hope you can give me a help.
Thank you in advance.
Download Examples
Only Top-Level windows (Forms) support alpha transparence in Winforms, but not controls.
If you want to have semi-transparent controls in Winforms you'll have to implement that feature by yourself.
See this post as an example:
Winforms: Making a control transparent
Edit:
If you want a transparent / semi-transparent MessageBox, you have to create it yourself. Simply inherit from Form (which supports transparency) and create the look and feel that you want to have. Then you can simply set the opacity of 'your' MessageBox:
myMessageBox.Opacity = .75;
If you want more control over the appearance of your controls you should consider using WPF. Here is a WPF-controll that seems to fit your needs:
All-Purpose Message Box in WPF

How does Visual Studio 2012 draw its window border?

How can I achieve the same alpha border effect that can be seen in the new Visual Studio 2012 main window using windows forms? Its window seems to glow.
So I am not sure if it is the best method, but if you use Spy++ (32-bit) and you look in the windows, you can see that beneath Visual Studio's main window, you can see 4 "VisualStudioGlowWindow" objects.
I hooked the messages in Spy++, and as you could imagine, the 4 windows represent the 4 glowing borders around the form. Further inspection shows that these 4 "glow windows" implement the WS_EX_LAYERED Extended window style, so the glow itself isn't done in WPF (as far as I can tell.)!
Hopefully this clears some stuff up.
AFAIK you can do it with WPF using a mix of this chrome and a custom WPF border. Not sure if on WinForms you can, given it's limited styling options (compared with WPF). Anyway they are using WPF.
Unless you want to handle drawing the entire form yourself you cannot. Because Visual Studio 2010 and Visual Studio 2012 are written on top of WPF and used Windows not Forms.
Visual Studio 2012 draw its window border using native Win32 functions. It is not related to the WPF or WindowsForms -- you can do it with both.
The glow is rendered on a transparent window on top of the main window. The main window calls the DWM API to set the glass area to 0. This way you can draw over the original border and the system buttons. This is the correct way to do this.
You can look at code of WPF Shell (http://archive.msdn.microsoft.com/WPFShell) to see how the calls to DWM are made in order to remove the glass. The fact that its written to be compatible with WPF doesnt matter, because all you need is a handle (IntPtr) to the window.
If you have a WindowsForms codebase, don't migrate to WPF. WPF has not been improved in the latest .NET framework release and there are no roadmaps to improvements or new features as its team has been integrated into Windows 8 team.

How to set Themes in Windows Application as in Web?

I am Creating a Windows Application in which there numerous forms. I want to create a general theme for all forms like style sheets or theme files in webapplication. Is there any way for setting themes in Windows application?
Unfortunately this is something that lacks support in WinForms. There are third party controls allowing you to achieve this but nothing out of the box. This concept has been introduced in WPF which is intended to replace WinForms.
You can use a third party dll to change theme of your windows form like DotnetSkin, DevExpress etc.

Categories

Resources