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?
“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.
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.
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.
Xamarin. Forms supports a wide variety of platforms, so called platform backends. Some of these are iOS, Android, macOS, UWP, GTK or WPF.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With