ActionBehavior.Livet 0.3.0

dotnet add package ActionBehavior.Livet --version 0.3.0
NuGet\Install-Package ActionBehavior.Livet -Version 0.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ActionBehavior.Livet" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ActionBehavior.Livet --version 0.3.0
#r "nuget: ActionBehavior.Livet, 0.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ActionBehavior.Livet as a Cake Addin
#addin nuget:?package=ActionBehavior.Livet&version=0.3.0

// Install ActionBehavior.Livet as a Cake Tool
#tool nuget:?package=ActionBehavior.Livet&version=0.3.0

ActionBehavior.Livet

Action Behavior for Livet.
Provides a function to easily call an action class from View (xaml).

License

MIT-License

NuGet

https://www.nuget.org/packages/ActionBehavior.Livet/

SetUp

  • Install LivetCask.Mvvm and ActionBehavior.Livet by NuGet.
  • Add an action resolver in your project.
using System.ComponentModel.Composition;
using ActionBehavior.Livet;
using Livet;

namespace Hoge
{
    [Export(typeof(IActionResolver))]
    public class ActionResolver : IActionResolver
    {
        public string Resolve(ViewModel vm, string action);
        {
            return $"Hoge.Actions.{action}"
        }
    }
}
  • Add an ViewModel
using Livet;

namespace Hoge
{
    public class MainWIndowViewModel : ViewModel
    {
    }
}
  • Add an action class.
using System;
using System.Threading.Tasks;
using Livet;

namespace Hoge
{
    public class Hello : ActionCommand<MainWindowViewModel>
    {
        public override Task<bool> Execute(object sender, EventArgs evnt, object parameter)
        {
            System.Windows.MessageBox.Show("hello");

            return OK;
        }
    }
}


  • Call Excute on view (xaml)
<Window 
        ・・・(略)・・・
        xmlns:ab="clr-namespace:ActionBehavior.Livet;assembly=ActionBehavior.Livet"
        >
    <Window.DataContext>
        <vm:MainWindowViewModel/>
    </Window.DataContext>

<Button Content="Hello">
    <i:Interactions.Triggers>
      <i:EventTrigger EventName="Click">
          <ab:Execute Action="Hello" />
      </i:EventTrigger>
    </i:Interactions.Triggers>
</Button>
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0 166 6/24/2023
0.2.0 156 4/29/2023
0.1.0 183 4/29/2023