{"id":16225450,"url":"https://github.com/mikebild/reactivemvvm","last_synced_at":"2025-03-19T12:30:58.035Z","repository":{"id":1420321,"uuid":"1531101","full_name":"MikeBild/ReactiveMVVM","owner":"MikeBild","description":null,"archived":false,"fork":false,"pushed_at":"2012-07-31T10:52:53.000Z","size":18148,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-28T18:42:52.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MikeBild.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-03-27T00:40:18.000Z","updated_at":"2021-04-14T04:43:56.000Z","dependencies_parsed_at":"2022-07-29T13:09:50.113Z","dependency_job_id":null,"html_url":"https://github.com/MikeBild/ReactiveMVVM","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2FReactiveMVVM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2FReactiveMVVM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2FReactiveMVVM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2FReactiveMVVM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeBild","download_url":"https://codeload.github.com/MikeBild/ReactiveMVVM/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243989576,"owners_count":20379648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T12:45:06.950Z","updated_at":"2025-03-19T12:30:57.423Z","avatar_url":"https://github.com/MikeBild.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"ReactiveMVVM Toolkit\r\n\r\nis a small MVVM Toolkit with base classes for build Silverlight applications that using the MMVM pattern. ReactiveMVVM is based on Rx.NET as inmemory message bus and AutoFac as DI based instance lifecycle manager and type resolver.\r\n\r\nHOW TO USE\r\n\r\nENVIRONMENT - Application BootStrapper \u0026 Application Host\r\n\r\n1) Build your own BootStrapper for type registrations\r\n\t\r\n\tpublic class TodoListBootStrapper : BootStrapper\r\n    {\r\n        public TodoListBootStrapper()\r\n        {\r\n            Builder.RegisterType\u003cIsolatedStorageUnitOfWork\u003e().As\u003cIIsolatedStorageUnitOfWork\u003e();            \r\n        }\r\n\r\n        public override void Configure()\r\n        {\r\n            base.Configure();\r\n            Startup();\r\n        }\r\n    }\r\n\r\n2) Add BootStrapper configuration to application startup\r\n\t\r\n\tpublic partial class App : Application\r\n    {        \r\n        public App()\r\n        {            \r\n            new TodoListBootStrapper().Configure();\r\n\t\t}\r\n\t}\r\n\t\r\n3) Build application environment by inheriting from SilverlightAppHost\r\n\r\n    public class MyAppHost : SilverlightAppHost\r\n    {\r\n\t\t...\r\n\t}\r\n\r\n4) Override Start() by implementing application startup operations\r\n\r\n    public class MyAppHost : SilverlightAppHost\r\n    {\r\n\t\tpublic override void Start()\r\n\t\t{ \r\n\t\t  ...\r\n\t\t}\r\n\t}\r\n\t\r\nVIEWMODEL\r\n\r\nThe ViewModel has two parts. One is the ViewModel self and one is a PageController for the ViewModel, View and external component communication.\r\n1) Create you data or domain model like:\r\n\tpublic class TodoItem\r\n    {\r\n        public string Description { get; set; }\r\n        public bool IsDone { get; set; }\r\n        public Guid TodoId { get; set; }\r\n    }\r\n\r\n2) Create a ViewModel by implement the IViewModel tagging interface. For example:\r\n\tpublic class MyViewModel : IViewModel\r\n    {\r\n        private readonly ObservableCollection\u003cTodoItem\u003e _toDos = new ObservableCollection\u003cTodoItem\u003e();\r\n        public ReadOnlyObservableCollection\u003cTodoItem\u003e ToDos { get; private set; }\r\n\r\n        public MyViewModel()\r\n        {\r\n            ToDos = new ReadOnlyObservableCollection\u003cTodoItem\u003e(_toDos);\r\n        }\r\n\t}\r\n\r\n3) Create a PageController\tby inheriting from PageController\u003cT\u003e. For example:\r\n\tpublic class MyPageController : PageController\u003cMyViewModel\u003e\r\n    {\r\n        public MyPageController()\r\n\t\t{\r\n\t\t\tMyCommand = new DelegateCommand\u003cTodoItem\u003e(todoItem=\u003e{ ... });\r\n\t\t}\r\n\t\t\r\n\t\tpublic ICommand MyCommand { get;set;}\r\n\t}\r\n\r\n4) Register the PageControlle as static application resource in your App.xaml like:\r\n\t\u003cApplication.Resources\u003e\r\n        \u003cResourceDictionary\u003e\r\n            \u003cPages:MyPageController x:Key=\"myPageController\" d:IsDataSource=\"True\" /\u003e \r\n        \u003c/ResourceDictionary\u003e\r\n    \u003c/Application.Resources\u003e\r\n\t\r\n5) Register the PageController in your XAML UserControl or XAML Page definition like:\r\n\t\u003cControls:Page x:Class=\"...\"\r\n\t...\r\n\tDataContext=\"{Binding Source={StaticResource myPageController}}\"\r\n\t...\r\n\t\u003c/Controls:Page\u003e\r\n\t\r\n6) Now you can invoke commands in XAML views by using standard triggers like Command=\"{Binding MyCommand}\" or interaction triggers from System.Windows.Interactivity. For example:\r\n\t--- As Standard Command ---\r\n\t\u003cButton Content=\"Neu\" Height=\"23\" HorizontalAlignment=\"Left\" Margin=\"0,300,0,0\" Name=\"button1\" VerticalAlignment=\"Top\" Width=\"200\" Command=\"{Binding MyCommand}\" /\u003e\r\n\t--- In Page ---\r\n\t\u003cInteractivity:Interaction.Triggers\u003e\r\n        \u003cInteractivity:EventTrigger EventName=\"Loaded\"\u003e\r\n            \u003cInteractivity:InvokeCommandAction Command=\"{Binding MyCommand}\"/\u003e\r\n        \u003c/Interactivity:EventTrigger\u003e\r\n\t\u003c/Interactivity:Interaction.Triggers\u003e\r\n\t--- In Templates ---\r\n\t\u003cCheckBox IsChecked=\"{Binding IsDone, Mode=TwoWay}\" Content=\"2\" Height=\"16\" HorizontalAlignment=\"Left\" Width=\"20\" VerticalAlignment=\"Top\" Margin=\"0,4,0,0\"\u003e\r\n\t\t\u003cInteractivity:Interaction.Triggers\u003e\r\n\t\t\t\u003cInteractivity:EventTrigger EventName=\"Click\"\u003e\r\n\t\t\t\t\u003cInteractivity:InvokeCommandAction Command=\"{Binding Path=MyCommand, Source={StaticResource myPageController}}\" CommandParameter=\"{Binding}\"/\u003e\r\n\t\t\t\u003c/Interactivity:EventTrigger\u003e\r\n\t\t\u003c/Interactivity:Interaction.Triggers\u003e\r\n\t\u003c/CheckBox\u003e\r\n\r\nCOMMANDS\r\nReactiveMVVM has 4 easy to use commands implemented.\r\n\t---  DELEGATECOMMAND - a classic delegate based command ---\r\n\tpublic class DelegateCommand\u003cT\u003e : ICommand where T : class\r\n\t--- \r\n\tpublic ICommand MyCommand { get;set; }\r\n\tMyCommand = new DelegateCommand\u003cTodoItem\u003e(x =\u003e { /*invoked by ICommand.Execute */});\r\n\r\n\t--- PUBLISHCOMMAND - a message bus based command for publishing a event message ---\r\n\tpublic class PublishCommand\u003cTBinding\u003e : ICommand where TBinding : class\r\n\t---\r\n\tpublic ICommand MyCommand { get;set; }\r\n\tMyCommand = new PublishCommand\u003cTodoItem\u003e(x =\u003e new TodoItemDescriptionChanged() { Id = x.TodoId, NewDescription = x.Description } /*return the IEventMessage to publish*/ );\r\n\r\n\t--- SENDCOMMAND - a message bus based command for sending a command message ---\r\n\tpublic class SendCommand\u003cTBinding\u003e : ICommand where TBinding : class\r\n\t---\r\n\tpublic ICommand MyCommand { get;set; }\r\n\tMyCommand = new SendCommand\u003cTodoItem\u003e(x =\u003e new LoadTodoItemList() /*return the ICommandMessage to send*/ );\r\n\r\n\t--- REGISTERCOMMAND - a message bus based command for registing to recieve messages ---\r\n\tpublic class RegisterCommand\u003cTMessage\u003e : ICommand where TMessage : class, IMessage\r\n\t---\r\n\tpublic ICommand MyCommand { get;set; }\r\n\tMyCommand = new RegisterCommand\u003cTMessage\u003e(x =\u003e { /*invoked by receiving a IMessage from message bus */  });\r\n\t\r\nTRIGGER\r\nReactiveMVVM has 2 easy to use triggers for using in XAML implemented.\r\n\t--- MESSAGETRIGGER - a trigger to send a message to message bus ---\r\n\t\t\u003cButton Content=\"MessageBox\" Height=\"23\" HorizontalAlignment=\"Left\" Margin=\"61,140,0,0\" Name=\"button1\" VerticalAlignment=\"Top\" Width=\"75\"\u003e\r\n            \u003cInteractivity:Interaction.Triggers\u003e\r\n                \u003cInteractivity:EventTrigger EventName=\"Click\"\u003e\r\n                    \u003cXaml:MessageTrigger CommandMessage=\"ShowMessageBox\" /\u003e\r\n                \u003c/Interactivity:EventTrigger\u003e\r\n            \u003c/Interactivity:Interaction.Triggers\u003e\r\n        \u003c/Button\u003e\r\n\t\r\n\t--- NAVIGATETOTRIGGER - a trigger to navigate to other page ---\r\n\t\u003cButton Content=\"Back\" Height=\"23\" HorizontalAlignment=\"Left\" Margin=\"0,327,0,0\" Name=\"hyperlinkButton1\" VerticalAlignment=\"Top\" Width=\"200\"\u003e\r\n\t\t\u003cInteractivity:Interaction.Triggers\u003e\r\n\t\t\t\u003cInteractivity:EventTrigger EventName=\"Click\"\u003e\r\n\t\t\t\t\u003cXaml:NavigateToTrigger NavigateUrl=\"/View/ToDoListPage.xaml\"/\u003e\r\n\t\t\t\u003c/Interactivity:EventTrigger\u003e\r\n\t\t\u003c/Interactivity:Interaction.Triggers\u003e\r\n    \u003c/Button\u003e\r\n\r\nNAVIGATION\r\n1) For using navigation add following to MainPage.xaml\r\n\t\u003cnavigation:Frame Source=\"{YourStartupPageName}.xaml\" ReactiveMVVM:SilverlightAppHost.RegisterFrame=\"True\" /\u003e\r\n\r\n2) and add following to App.xaml to register a static application resource object for holding state of navigation parameter\r\n\t\u003cApplication.Resources\u003e\r\n        \u003cResourceDictionary\u003e\r\n            \u003cNavigation:NavigationParameter x:Key=\"navigationParameters\" d:IsDataSource=\"True\" /\u003e\r\n        \u003c/ResourceDictionary\u003e\r\n    \u003c/Application.Resources\u003e\r\n\r\nMESSAGE BUS\r\nThe message bus is the central application hub for component communication. The message bus manage and orchestrate the collaboration between all application \r\ncomponents and all page controllers by using a message based communication pattern.\r\nEVENT \u0026 COMMAND HANDLING\r\n\r\n\t\r\n\t\r\nPERSISTENCE\r\ncomming soon\r\n\r\n\r\nBACKLOG:\r\nNavigation GoBack Command and Trigger\r\nNavigation GoForward Command and Trigger\r\nObject Parameter in MessageTrigger\r\nIUnitOfWork instead of IIsolatedStorageUnitOfWork\r\nwcf based persistence\r\nreactive repository abstraction that using rx messagebus\r\nwcf client integration for remote query, commands and events\r\na wpf and wp7 port\r\nbuild up a NuGet package\r\nsome more samples for API validation\r\nsome integration tests\r\n\r\n\r\nReactiveMVVM is inspired by MVVM Light Toolkit.\r\nReactiveMVVM using external libs AutoFac, Rx.NET from NuGet repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikebild%2Freactivemvvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikebild%2Freactivemvvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikebild%2Freactivemvvm/lists"}