Open ricaun opened 8 months ago
I created a stable version to use inside Revit, here is a release with the custom package.
https://github.com/ricaun/wpfui/releases/tag/2.2.0-pre-revit
To apply the resource just use the Wpf.Ui.Appearance.Theme.Apply(this)
after your InitializeComponent()
.
The assembly was changed to Revit.Wpf.Ui.2.2.0
to avoid conflicts with the original Wpf.Ui
package.
Is your feature request related to a problem? Please describe
If the
Application.Current
is null theWpf.Ui
library does not work, too manyApplication.Current
are hard coded.This problem is related to #662 and #668
Describe the solution you'd like
A way to use the
Wpf.Ui
library even if theApplication.Current
is null.Describe alternatives you've considered
I was experimenting with version 2.2.0 a way to fix the problem by swapping all the
Application.Current
to a custom classUiApplication.Current
to manage the Resources from theApplication.Current
if not null or return the Resources from a static internalResourceDictionary
.This approach gonna ensure that all the current implementations stay the same. The alternative
ResourceDictionary
gonna be used if the Application is null.Here is a full repo with that implementation: https://github.com/ricaun/wpfui/tree/2.2.0-uiapplication
I created the project
Wpf.Ui.SimpleConsoleDemo
with a working implementation whenApplication.Current
is null.Additional context
Before creating a PR, I would like to discuss whether that approach makes sense to implement in the main library.