Native UI using WPF - c#

I'm switching from Windows Forms to WPF, but WPF's GUI is really ugly. It looks like Windows 95 or something like that.
Example:
Left is a new WPF project
Right is a new Windows Forms project
Both only have a button and textbox added to the project, no other changes.
As you can see, WPF doesn't have the "native Windows GUI". I know that I can use themes, but I just want the native Windows GUI. Isn't there any setting to do this without themes? I've found this but I didn't change anything in the project except for the button and the textbox and it still doesn't look native.

See this workaround. there's some button styles there to make the buttons look more similar to the native ones. Other than that, see here the official statement from Microsoft that this difference is actually by design. They made intentional changes to the themes to make them more lightweight by removing gradients and such.

Related

Integrate WinForms project into WPF

I've been working on a project for some time, and it requires alphablended non rectangular forms...
which in a little research I found can be easily done in WPF. So I decided to port my project from WinForms to WPF.
There are a few complications like a reference DLL based on WinForms I've been using doesn't work under WPF; it doesn't even show in the designer toolbox. I already tried loading it into the toolbox by right clicking and selecting Choose Items.., but it does not show there either.
I have never worked on WPF before, but it looks so promising for my requirements.
So is there anything I could do to integrate my project into WPF?
There is a control named 'WindowsFormsHost' in WPF. You can find it in toolbox. Drag it on the form and then you can use windows controls and user controls on it.
Hope this information will help.

How can I make the mainMenuStrip look glossy in a Windows forms application

I'm trying to make a nice looking UI with Windows Forms but the main problem I have is that the MenuStrip in Windows Forms looks flat. In WPF everything is shiny and pops out, how can I make it so that it looks like that? I tried using a gradient background image but the buttons stayed as blue rectangles. I am also willing to use an alternative control. Any ideas?
I forgot to mention, regarding alternative controls I am looking for something free and open-source.
My personal suggestion would be that you move from menustrips to "Office-like" menus / ribbons.
Please go through the following links / search through these sites
for more custom controls for winforms
Code Project
http://www.codeproject.com/Articles/12204/Flat-style-menu-bar-and-popup-menu-control-for-Win
Windows Ribbon for WinForms (Part 1-21)
http://www.codeproject.com/Articles/62412/Windows-Ribbon-for-WinForms-Part-1-Introduction
Code Plex
http://ribbon.codeplex.com
http://fluent.codeplex.com
http://windowsribbon.codeplex.com

WinForms Dialogs in WPF Application: Controls look like .NET 2.0

I have an WinForms application and started to convert it into WPF. To have less work, my idea was to let the old dialog windows be WinForms. In the VS2010-designer the dialogs looks normal (with .NET 3.5/4.0 controls) but if I run my program all WinForms controls change into an old style and it looks like .NET 2.0 (I think you know what I mean, that grey bevel style for all controls...)
What happens there? Any ways to fix that?
You have to call System.Windows.Forms.Application.EnableVisualStyles() to enable the system style for Windows Forms.
The WinForms project template contain that call by default; the WPF template is missing it as WPF controls do not need it.

WPF form displaying as winform

Sorry this is probably a really silly question but I am developing a WPF form on a Windows 7 machine with VS2010 yet when running the application the form still looks like a standard WinForms window.
I am assuming that it requires an extra component installed on the system to be displayed as shown in the designer?
PS: To be more specific what I am referring to is basically the outline and border.
No, what you are experiencing is totally normal. Unless you have altered the default style of your controls, your application will be drawn using windows default look and feel.
That border is just for design purposes. But you could add your own Border to recreate it during runtime.

c# how can i make sure that my application will look the same on other systems?

how do i make sure that the application iam developing will look the same on other windows-systems?
iam developing now on a windows7, with .net 3.5 framework .. (VS 2008)
as an example, i have a toolbar, that i changed its rendermode to system, it looks ok on my windows7, but when i run the application on windows xp, it is different, even the onmouseover backcolor is different. ..
is there a way to make the application looks like on every windows system (talking abt xp, vista and windows 7 only), lets say like exporting the settings of all the controls with the application !? or any trick to make sure it will be always the same ?
thankss in advance
Unless you render the window yourself you're going to always have slight differences between OS'es, they all have different ways of rendering your primitive controls like text boxes, panels, etc.
Also under windows the background color of a window/control is actually (by default) tied into the theme set in windows.
So allowing people to use their own themes is a plus. You really shouldn't force a style on people unless you're theming your own application.
You would have to you get a grab on all of the colours, fonts, transperancy, etc. and use them to override every controls' Paint event/method so that they may use your values.
The only way I see fit would be by writing yourself custom controls while handling these controls appearance throught the Paint() method so that the control may use what you give it. The pain!...
As SLaks commented, you shouldn't care about such details and let the defaut user preferences take over on the native OS, because some surprises may be encountered over time as if Windows doesn't find the font, for instance, it will replace it with its default, which could lead to horrible results. That is just one example. Need others?

Categories