Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the native "look and feel" using WPF?

I've just started developing a WPF application. This is not my first WPF app, but it will be the first that needs some polish. I know quite a bit about the "plumbing" of WPF such as binding, etc., but very little about how to polish it up. I don't need a snazzy UI. I just need something that looks like a native Windows app. For instance, if the app runs on XP, I want it to look like an XP app and pick up the user's UI theme. Same thing on Vista, etc.

How can I do this?

like image 977
Gregory Higley Avatar asked Dec 19 '08 04:12

Gregory Higley


People also ask

Will WPF be discontinued?

“WPF would be dead in 2022 because Microsoft doesn't need to be promoting non-mobile and non-cloud technology. But WPF might be alive in that sense if it's the best solution for fulfilling specific customer needs today. Therefore, having a hefty desktop application needs to run on Windows 7 PCs with IE 8.

Can we design web based app in WPF without XAML as well?

But WPF without XAML is possible. You don't even need Visual Studio installed for this, just the . NET CLI and the Developer Command Prompt. Drop these two files in a folder and run msbuild and then you can run the file in the Bin directory.

Is xamarin same as WPF?

WPF supports the concept of Control Templates which provide the visualization instructions for a control ( Button , ListBox , etc.). As mentioned above, Xamarin. Forms uses concrete rendering classes for this which interact with the native platform (iOS, Android, etc.) to visualize the control.

Does xamarin use WPF?

Xamarin. Forms supports a wide variety of platforms, so called platform backends. Some of these are iOS, Android, macOS, UWP, GTK or WPF.


1 Answers

You should be able to put this into the application's OnLoad event to use the Vista theme, for example:

Uri uri = new Uri("PresentationFramework.Aero;V3.0.0.0;31bf3856ad364e35;component\\themes/aero.normalcolor.xaml", UriKind.Relative); 

Resources.MergedDictionaries.Add(Application.LoadComponent(uri) as ResourceDictionary);

or for the Windows XP theme: themes/Royale.normalcolor.xaml

like image 162
Mark Carpenter Avatar answered Oct 23 '22 12:10

Mark Carpenter