Apply unsigned Windows theme in WPF - wpf

I am using Soft7 2.0 from DA (unsigned theme) and I'm using the UxStyle service to load it.
Most applications adjust their UI just fine, but not WPF apps.
How can I make WPF apps also use the Soft7 UI? I'm not looking to force a certain theme on WPF, I just want it to use the current Windows theme.
I'm running Windows 7 x64.

WPF and Win32 are very different technologies, which is why it is so easy to port WPF to new operating systems: It has practically no reliance on Win32.
When it comes to custom themes, WPF templates completely changes the ballgame: Custom themes in WPF are much more powerful but also very different from Win32. This means that theme vendors must implement their theme for both Win32 and WPF.
If system theme includes both a Win32 and a WPF DLL, all you need to do is make sure the WPF DLL is in your application directory or in the GAC. WPF will automatically load it and use it based on the registered theme name. Installing a theme on the system that includes a WPF DLL should automatically register it in the GAC.
If the theme includes only Win32 code and doesn't include any WPF templates, the only way to get the same look and feel from WPF is to code your own templates to match those in the theme. Fortunately this is very easy to do.

Related

WPF native controls in Xamarin

I was playing around with Xamarin and WPF after following the BoxViewClock tutorial from the Xamarin website but apart from that one article, which has been duplicated on a number of sites I cannot find any other advanced examples.
Is it currently possible to add/use a WPF custom control to an xamarin forms page? or for that matter a view/user control?
You typically start creating a custom control by deriving from one of Xamarin.Forms controls and you do it in shared .NET Standard library with Xamarin.Forms UI project. As soon as there's behavior which is not feasible within Xamarin.Forms you create a native renderer in a project targeting specific platforms, in our case in WPF project. Thus there're 2 steps for creating custom controls in Xamarin.Forms:
Derive from existing Xamarin.Forms controls in Shared project
Add extensions to it via platform renderer (or behaviour which is a custom case of renderer) in platform project.
You can find example of creating "ExtendedLabel" control which adds to the standard Xamarin.Forms' Label with capability to change cursor to Hand when mouse hovers over the label in WPF application:
Xamarin.Forms control: https://github.com/maxim-saplin/CrossPlatformDiskTest/blob/master/Saplin.CPDT.UICore/Controls/ExtendedLabel.cs
WPF platfrom renderer: https://github.com/maxim-saplin/CrossPlatformDiskTest/blob/master/Saplin.CPDT.WPF/ExtendedLabelRenderer.cs - you can ignore the code after "if (label.FormattedText != null &&..." which is a workaround for a bug in Xamarin.WPF and not related to the questions
P.S.: in the repo there's also a renderer for macOS which implements the same behaviour

how to use ProgressRing in a WPF application for windows

As simple as in the title, I'd like to know how to use a ProgressRing on my gui. I can't figure out how to import the Windows.UI.Xaml.Controls namespace in which seems to be located.
Thanks!
Eugenio
I don't think you can add a reference to a Windows Store Apps DLL to a WPF project, they are built against different versions of the framework.
You could however use a ProgressRing from a different WPF targeting DLL; MahApps Metro has one https://mahapps.com/docs/controls/progressring (source is on github so you can just take what is needed without having to jump fully into the metro style)
Or you could implement your own following a tutorial http://henryzhu1997.wordpress.com/2013/06/18/creating-a-progressring-for-wpf/

WinRT and WPF in Windows 8

As I understand, WinRT is a different version of WPF written without using the underlying Win32 APIs.
What's the relation of WinRT and WPF? Will WPF work under Metro in Windows 7 or will it launch the classic desktop?
That's not so clear from the Keynote. If someone has Windows 8 installed can confirm it's behaviour.
Thanks
WinRT is a replacement for the Winapi. The api is native, very unlike WPF that runs as a layer on top of the CLR. It certainly resembles WPF, part of what causes confusion. It adopted the metadata format of managed code, replacing type libraries of old. And uses XAML for UI designs, much like WPF, Silverlight and Windows Phone. You can still write WPF apps for Windows 8 but your app can't be published through the store, won't integrate with the Metro desktop nor will it run on tablets that are based on the ARM core. Whether that's a real problem depends a great deal on how well Metro will do in the market place.
There is no relation between WPF and WinRT, just like there is no relation between Silverlight and WPF. Now we have three technologies, WPF, Silverlight and WinRT.
If you try to execute WPF application, it will not execute on Metro, it will execute in the classical desktop only.
In Visual Studio 2011, you have WPF and Metro as two different types of applications, and Xaml for WPF and WinRT is not same, Xaml for WinRT is pretty much same as that of Silverlight as lot of classes which exist for WPF are missing in WinRT library. But most of classes that exist for Silverlight are available in WinRT.
Windows Runtime (WinRT) is an alternative API used to create Metro Applications
(and later server application).
The APIs are class/method/struct based and surfaced to .Net metro apps, html5/css3/javascript apps and C/C++ metro applications.
The implementation is native.
APIs are made visible via .winmd files, which contain metadata very similar to the metadata you have in .Net assemblies.
The APIs are designed to secure and async friendly with many APIs requiring the use of async/await due to them potentially taking more than 50msec to execute.
It includes a subset of Win32 APIs and COM apis.
Anyway... the followings links help... channel9 also has some //Build/ videos on the subject..
Metro style app development
- http://msdn.microsoft.com/en-us/windows/apps/
Win32 and COM for Metro style apps
- http://msdn.microsoft.com/en-us/library/windows/apps/br205757(v=VS.85).aspx
APIs for Metro style apps
- http://msdn.microsoft.com/en-us/library/windows/apps/br211369(v=VS.85).aspx
WinRT is a new library that you can use XAML, but not WPF.
WPF is primarily uses DirectX for visual.
You can use WinRT with:
XAML
C#
C++
VB.NET
HTML/JS/CSS
WinRT is a non managed API based on COM interfaces. You use it by calling objects buit in .winmd metadata files ( Windows\System32\WinMedataData directory).
All the namespaces begin with "Windows.".
You can write your Windows 8 application by using XAML files, but that's the only common point with WPF.

Is it possible to use Silverlight Toolkit themes in Windows Phone 7 applications?

Is that possible to use themes from Silverlight Toolkit in Windows Phone 7 applications?
Or they are only for desktop/web applications and not included in toolkit for WP7?
Is there any tricks that could let me use them in my app?
Theming support is not built into the toolkit for WP7.
The controls in the Phone version of the Toolkit support the configurable themes on the phone. (i.e. Dark/light themes and accent colours.)
If you wanted to do this and had re-templated all the other controls you were using, it shouldn't be that much more work to apply your custom styles to the toolkit controls too.
Windows Phone 7 has adopted a style of theming refered to as Metro. You can get some background on this if you watch CL14 from Mix10.
The resources you can use are covered here.
Theme Resources for Windows Phone
You aren't obliged to follow this theming however and can integrate other styles if you choose to.
Ok,
I figure it out by myself.
All you need to do to use original Silverlight Toolkit themes is to
Get its sources
Take out themes xaml files from them
Place this needed theme as a style for desired control in your WP7 app resouces
Apply new style to desired control.

How do I build a Style Library for use in Silverlight Class Libraries?

I have a Silverlight application that is built from a set of Silverlight class libraries. I would like to create a common Silverlight library that contains a set of resources used to define the styles used for all the Silverlight UI libraries. This would be simlar to the <Styles>'s defined in the node within App.xaml file.
Is this possible? And if so, how would I implement?
While this is possible using WPF (via Dynamic Resources, see this video and fast forward to 12:00), I don't think this is possible yet in Silverlight. The closest thing you have to this is the themes in the Silverlight toolkit. There is a comment on that page by the team stating that you can't change themes (or resource styles) at runtime in Silverlight 2:
unruledboy, We do not support changing themes at run-time as this is not an ability supported by the Silverlight framework.
So I think themes is the closest thing available right now.

Resources