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

Expander animation slower in class library #3659

Open
mouawadma opened this issue Aug 22, 2024 · 2 comments
Open

Expander animation slower in class library #3659

mouawadma opened this issue Aug 22, 2024 · 2 comments
Labels
bug evaluation required Items is pending review or evaluation by the team

Comments

@mouawadma
Copy link

mouawadma commented Aug 22, 2024

Bug explanation

Here is a project example
https://github.com/mouawadma/MDIXExpanderIssue

I am noticing that the expander animation is much slower when using it as part of a class library versus an independent application. Not sure why this is the case. I have attached two gifs to show it. Not sure what could be causing this?

Class Library

ClassLibrary

Independent App

IndepedentApp

Version

V5.1

@mouawadma mouawadma added bug evaluation required Items is pending review or evaluation by the team labels Aug 22, 2024
@corvinsz
Copy link
Contributor

corvinsz commented Sep 1, 2024

@mouawadma I feel like using a theming library inside of another library is quite the hassle.
Adding the resource dictionary in the static constructor of your Window1.xaml works. However this has the drawback of not having intellisense for MDIX resources in your xaml.

public partial class Window1 : Window
{
	static Window1()
	{
		var resources = new ResourceDictionary
		{
			Source = new Uri("pack://application:,,,/TestingMDIX51Local;component/Theme.xaml", UriKind.RelativeOrAbsolute)
		};
		Application.Current.Resources.MergedDictionaries.Add(resources);
	}
	public Window1()
	{
		InitializeComponent();
	}

	private void InitializeMaterialDesign()
	{
		// Create dummy objects to force the MaterialDesign assemblies to be loaded
		// from this assembly, which causes the MaterialDesign assemblies to be searched
		// relative to this assembly's path. Otherwise, the MaterialDesign assemblies
		// are searched relative to Eclipse's path, so they're not found.
		var card = new Card();
	}
}

ExpanderTimeBug

Notice how your InitializeMaterialDesign() method is still there and needed as described by your comment. However the method isn't even called and to my knowledge it should be optimized out by the compiler. This is very odd.

@mouawadma
Copy link
Author

mouawadma commented Nov 25, 2024

An external application calls our code and there are a lot of issues with it. I have no control over this and it has been found that dummy code is required to get everything loaded correctly.

All-in-all, I have to use a class library and I would like to use MDIX so I am short on options.

I tried your solution, and it seems to fix the issue of the slow expander, but makes the XAML horrible to use since there is not intellisense... wonder if there is a different way to resolve the issue? Why does my initial solution of setting the style in the code behind not work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug evaluation required Items is pending review or evaluation by the team
Projects
None yet
Development

No branches or pull requests

2 participants