Skip to content

UiApplication.Current to fix Application.Current when null. #837

@ricaun

Description

@ricaun

Is your feature request related to a problem? Please describe

If the Application.Current is null the Wpf.Ui library does not work, too many Application.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 the Application.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 class UiApplication.Current to manage the Resources from the Application.Current if not null or return the Resources from a static internal ResourceDictionary.

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 when Application.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions