Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable the Application.Current #1081

Closed
ricaun opened this issue May 9, 2024 · 0 comments
Closed

Option to disable the Application.Current #1081

ricaun opened this issue May 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ricaun
Copy link
Contributor

ricaun commented May 9, 2024

Is your feature request related to a problem? Please describe

Hello, last year I introduce the UiApplication to fix the issue when the Application.Current was null.

Now I have a different problem, the Application.Current exist but I'm not the owner, I still don't have access to the App.xaml .

The ApplicationThemeManager.Apply(this); is not gonna work because the Application.Current exist and don't have the styles.

Describe the solution you'd like

A way to fix that would be to add a option in the UiApplication to set the System.Windows.Application manually as null.

UiApplication.Current.SetApplication(null);
// or
UiApplication.Current.SetApplication(Application.Current);

and

public SetApplication(Application application)
{
    _application = application;
}

There is another option as well to check if the Application.Current contain the the basic resources style, if does not contain any resource means is not the Application owner and assumes that is running outside of the desktop app context.

I like the second option.

Describe alternatives you've considered

I gonna try to create a pr with the second option to disable the Application.Current if does not have any sytle related to the Wpf.UI

Additional context

This issue is related for Revit 2025 plugins.

This happens if I inject the resources in the Application.Current, breaks some ui from other windows. 😅
Wpf UI - Revit 2025 - 2024-05-09 17-56-39

@ricaun ricaun added the enhancement New feature or request label May 9, 2024
@ricaun ricaun mentioned this issue May 9, 2024
7 tasks
@ricaun ricaun closed this as completed May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant