Caliburn.Micro icon indicating copy to clipboard operation
Caliburn.Micro copied to clipboard

[WIP] AvaloniaUI support

Open megazyz opened this issue 4 years ago • 12 comments

This makes Caliburn.Micro work with AvaloniaUI. Related to #556. Needs review and testing.

megazyz avatar Jan 19 '21 18:01 megazyz

This look interesting, I will try and a review it once I get an hour or two of free time.

KasperSK avatar Jan 29 '21 13:01 KasperSK

Could you add a sample AvaloniaUI app to the samples also?

vb2ae avatar Apr 17 '21 00:04 vb2ae

Could you add a sample AvaloniaUI app to the samples also?

Done.

I'm not sure where it would be ideal to start the CM bootstrapper. Now it's created in App.OnFrameworkInitializationCompleted() in App.axaml.cs. Another solution might be to include it as a resource in App.axaml like in WPF.

megazyz avatar May 16 '21 11:05 megazyz

Should we namespace this similarly to the Xamarin.Forms package? I don’t think we can determine whether or not a project uses Avalonia otherwise.

KasperSK avatar Jul 29 '21 10:07 KasperSK

I agree we need an Avalonia package similar to the xamarin.forms

vb2ae avatar Jul 29 '21 11:07 vb2ae

Also I think this was made before we reintroduced the Xamarin.Forms package so the branch needs to be rebased and the Caliburn.Micro.Platform.Core should be referenced as it is for the Xamarin.Forms package and the regular Caliburn.Micro package.

KasperSK avatar Jul 29 '21 11:07 KasperSK

What are the steps left to have this into Caliburn? It looks like it works but we need some restructuring? I could help some but am not sure where in the process we are atm.

Stannieman avatar Apr 26 '22 12:04 Stannieman

will work on fixing merge conflicts and see if we can get it merged in this weekend. It will need testing

vb2ae avatar Apr 27 '22 10:04 vb2ae

I tried a while back to include Avalonia in the features sample project, and ran into some issues with the way navigation was handled via frame adapter. I think if we can make it work with the features sample project it will be a good test.

KasperSK avatar Apr 27 '22 10:04 KasperSK

~I rebased this PR on the latest Caliburn master and was planning to move this forward a bit, but ran into some issues. It happens to be that the project I was using it in did not actually use Caliburn for navigation (I called ViewLocator and ViewModelBinder manually). Today I tried to use Conductor<T>.ActivateItemAsync like you should. However I found that it does not try to find a view. Am I missing something here or is this the navigation problem @KasperSK is talking about? There is nothing wrong with naming conventions, it does not call the ViewLocator at all.~

It was my fault. Ignore it.

Stannieman avatar Jul 15 '22 14:07 Stannieman

Created a branch of my own to keep working on this. https://github.com/Caliburn-Micro/Caliburn.Micro/tree/556-compatibility-inquiry-avaloniaui The biggest issue I have remaining is getting

      cal:Message.Attach="RegisterFrame($source)" 

events to fire.

vb2ae avatar Jul 16 '22 10:07 vb2ae

Created a branch of my own to keep working on this. https://github.com/Caliburn-Micro/Caliburn.Micro/tree/556-compatibility-inquiry-avaloniaui The biggest issue I have remaining is getting

      cal:Message.Attach="RegisterFrame($source)" 

events to fire.

~I have a fix/improvement, shall I make a pull request to your branch or how will we coordinate this?~ Made a PR.

Stannieman avatar Jul 16 '22 15:07 Stannieman

@megazyz and all! I am from Avalonia! I would like to help resurrect this PR.

@megazyz how complete is this?

danwalmsley avatar Mar 16 '23 12:03 danwalmsley

@megazyz and all! I am from Avalonia! I would like to help resurrect this PR.

@megazyz how complete is this?

@vb2ae I have seen your branch, testing it out! Would love to help get it finished. Let me know of how I can assist. For now I shall test it out find my way around!

danwalmsley avatar Mar 16 '23 12:03 danwalmsley

The latest Avalonia nightlies have some breaking changes. Luckily they are focussing on bug fixes for the upcoming version from now on so I don't expect more breaking stuff to be added.

One has to do with different parameters in InitializeComponent which is called through reflection by Caliburn. I have a fix for this locally that I'll create a PR for. One other issue has to do with registering event triggers, not sure exactly what is the cause there.

Then we need to also rebase this branch on master because I am sure there are some conflicts. Some other thing might still be missing that I don't encounter in my project, @vb2ae has more details about them I think.

Stannieman avatar Mar 16 '23 18:03 Stannieman

I apologize for my absence. Thank you for looking into this and continuing the development.

megazyz avatar Mar 17 '23 21:03 megazyz

@megazyz you do this in your free time so no apologies needed mate

Stannieman avatar Mar 17 '23 23:03 Stannieman