tibel / Caliburn.Micro.Extras

Some additions to Caliburn.Micro framework.
MIT License
15 stars 9 forks source link

Please provide a usage sample for the ActionCommand API #13

Closed Noemata closed 9 years ago

Noemata commented 9 years ago

Could you please provide a usage example of the ActionCommand API where it might benefit from the use of the weak reference (with associated XAML markup).

Thanks.

tibel commented 9 years ago

Caliburn.Micro.Extras is an old attempt of me to extend Caliburn.Micro. This project is now discontinued and I learned much that I would now make different.

The weak reference to the target is not needed, I know now. What is needed (or at least should be considered):

A more detailed explanation (for MVVM Light) you can find here: https://atomaras.wordpress.com/2012/04/23/solving-mvvmlights-eventtocommand-memory-leak-wp7/

In short: It is all about that the view-model has no strong reference to the view (XAML).

An updated version of ActionCommand (but not for Caliburn.Micro) you can find here: https://github.com/tibel/Caliburn.Light/blob/master/src/Caliburn.Core/Action/DelegateCommand.cs

Noemata commented 9 years ago

I would like to converse with you more directly (email address). I am interested in adding enhancements to Caliburn.Micro with supporting Vsix plugins. It's not something that has been undertaken in any organized fashion thus far.

A couple of the enhancements that I'd like to add greatly simplify aspects of the convention system when incorporating third party controls (Telerik, etc.). I also have a variation of something similar to your DelegateCommand implementation that I think merits inclusion after some tweaking. It integrates support for things like MultiKey bindings and global keyhooks through Xaml with conventions.

What are your thoughts on adding vsix support for Caliburn?
Caliburn.Micro is really in need of Templates and additional plumbing to smooth out the Visual Studio workflow. I would like to kick start the process.

Thank you for responding to my query,

Mario

Thomas Ibel mailto:notifications@github.com Saturday, January 31, 2015 5:30 AM

Caliburn.Micro.Extras is an old attempt of me to extend Caliburn.Micro. This project is now discontinued and I learned much that I would now make different.

The weak reference to the target is not needed, I know now. What is needed (or at least should be considered):

  • the weak event registration on the |PropertyChanged| event of the target
  • implementing |CanExecuteChanged| using weak events

A more detailed explanation (for MVVM Light) you can find here: https://atomaras.wordpress.com/2012/04/23/solving-mvvmlights-eventtocommand-memory-leak-wp7/

In short: It is all about that the view-model has no strong reference to the view (XAML).

An updated version of |ActionCommand| (but not for Caliburn.Micro) you can find here: https://github.com/tibel/Caliburn.Light/blob/master/src/Caliburn.Core/Action/DelegateCommand.cs

— Reply to this email directly or view it on GitHub https://github.com/tibel/Caliburn.Micro.Extras/issues/13#issuecomment-72312615.

tibel commented 9 years ago

Yes, a Visual Studio extension with project and item templates to replace the Caliburn.Micro.Start nuget package would be great.

@nigel-sampson is the project lead of Caliburn.Micro. He will be interested in this too. I suggest to continue the discussion on https://github.com/Caliburn-Micro/Caliburn.Micro