{"id":15429548,"url":"https://github.com/havendv/mvvm.interactions","last_synced_at":"2025-11-28T08:01:47.885Z","repository":{"id":41332980,"uuid":"420923553","full_name":"HavenDV/Mvvm.Interactions","owner":"HavenDV","description":"Common Interactions(like open/save file) for WPF/UWP/WinUI/Uno/Avalonia/MAUI platforms","archived":false,"fork":false,"pushed_at":"2024-03-11T22:05:18.000Z","size":40397,"stargazers_count":15,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-08T00:22:18.622Z","etag":null,"topics":["avalonia","common","csharp","dialogs","dotnet","drag-and-drop","interactions","mvvm","openfile","openfiledialog","savefile","savefiledialog","uno","uno-platform","uwp","windows","winui","winui3","wpf"],"latest_commit_sha":null,"homepage":"https://havendv.github.io/Mvvm.CommonInteractions/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HavenDV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"havendv","ko_fi":"havendv","custom":["https://www.paypal.me/havendv","https://www.buymeacoffee.com/havendv","https://www.upwork.com/freelancers/~017b1ad6f6af9cc189"]}},"created_at":"2021-10-25T07:38:24.000Z","updated_at":"2025-08-09T18:40:46.000Z","dependencies_parsed_at":"2023-12-19T01:55:35.561Z","dependency_job_id":"a4c4f63a-003c-4028-9847-501a7e78468b","html_url":"https://github.com/HavenDV/Mvvm.Interactions","commit_stats":{"total_commits":191,"total_committers":3,"mean_commits":"63.666666666666664","dds":"0.17801047120418845","last_synced_commit":"06de1677f4a39cc3a0fbada760844accce54cc47"},"previous_names":["havendv/h.reactiveui.commoninteractions","havendv/mvvm.interactions","havendv/mvvm.commoninteractions"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/HavenDV/Mvvm.Interactions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FMvvm.Interactions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FMvvm.Interactions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FMvvm.Interactions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FMvvm.Interactions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HavenDV","download_url":"https://codeload.github.com/HavenDV/Mvvm.Interactions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FMvvm.Interactions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27299009,"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","status":"online","status_checked_at":"2025-11-28T02:00:06.623Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["avalonia","common","csharp","dialogs","dotnet","drag-and-drop","interactions","mvvm","openfile","openfiledialog","savefile","savefiledialog","uno","uno-platform","uwp","windows","winui","winui3","wpf"],"created_at":"2024-10-01T18:11:27.182Z","updated_at":"2025-11-28T08:01:47.809Z","avatar_url":"https://github.com/HavenDV.png","language":"C#","funding_links":["https://patreon.com/havendv","https://ko-fi.com/havendv","https://www.paypal.me/havendv","https://www.buymeacoffee.com/havendv","https://www.upwork.com/freelancers/~017b1ad6f6af9cc189"],"categories":[],"sub_categories":[],"readme":"# [Mvvm.Interactions](https://github.com/HavenDV/Mvvm.Interactions/) \nCommon MVVM Level Interactions(like open/save file) for WPF/UWP/WinUI/Uno/Avalonia/Maui platforms.\nFeatures:\n- Easy interactions with files, message boxes, web from MVVM level.\n- Enables drag-and-drop support at the ViewModel level.\n- Wide choice of platforms\n- Dependency injection friendly\n\n### NuGet\n\n[![NuGet](https://img.shields.io/nuget/dt/Mvvm.Interactions.Core.svg?style=flat-square\u0026label=Mvvm.Interactions.Core)](https://www.nuget.org/packages/Mvvm.Interactions.Core/)\n[![NuGet](https://img.shields.io/nuget/dt/Mvvm.Interactions.Wpf.svg?style=flat-square\u0026label=Mvvm.Interactions.Wpf)](https://www.nuget.org/packages/Mvvm.Interactions.Wpf/)\n[![NuGet](https://img.shields.io/nuget/dt/Mvvm.Interactions.Uno.svg?style=flat-square\u0026label=Mvvm.Interactions.Uno)](https://www.nuget.org/packages/Mvvm.Interactions.Uno/)\n[![NuGet](https://img.shields.io/nuget/dt/Mvvm.Interactions.Uwp.svg?style=flat-square\u0026label=Mvvm.Interactions.Uwp)](https://www.nuget.org/packages/Mvvm.Interactions.Uwp/)\n[![NuGet](https://img.shields.io/nuget/dt/Mvvm.Interactions.WinUI.svg?style=flat-square\u0026label=Mvvm.Interactions.WinUI)](https://www.nuget.org/packages/Mvvm.Interactions.WinUI/)\n[![NuGet](https://img.shields.io/nuget/dt/Mvvm.Interactions.Avalonia.svg?style=flat-square\u0026label=Mvvm.Interactions.Avalonia)](https://www.nuget.org/packages/Mvvm.Interactions.Avalonia/)\n[![NuGet](https://img.shields.io/nuget/dt/Mvvm.Interactions.Maui.svg?style=flat-square\u0026label=Mvvm.Interactions.Maui)](https://www.nuget.org/packages/Mvvm.Interactions.Maui/)\n\n```\nInstall-Package Mvvm.Interactions.Core\nInstall-Package Mvvm.Interactions.Wpf\nInstall-Package Mvvm.Interactions.Uno\nInstall-Package Mvvm.Interactions.Uwp\nInstall-Package Mvvm.Interactions.WinUI\nInstall-Package Mvvm.Interactions.Avalonia\nInstall-Package Mvvm.Interactions.Maui\n```\n\n## Usage\nAdd to your App constructors:\n```cs\n\npublic sealed partial class App\n{\n    private IHost AppHost { get; }\n\n    public App()\n    {\n        AppHost = Host\n            .CreateDefaultBuilder()\n            .ConfigureServices(static services =\u003e\n            {\n                // Add all available interactions\n                services.AddMvvmInteractions();\n                \n                // or add only what you need\n                services.AddSingleton\u003cIFileInteractions, FileInteractions\u003e();\n                services.AddSingleton\u003cIMessageInteractions, MessageInteractions\u003e();\n                services.AddSingleton\u003cIWebInteractions, WebInteractions\u003e();\n            })\n            .Build();\n\n        // Optional. Displays unhandled exceptions using MessageInteractions.Exception.\n        AppHost.Services.GetRequiredService\u003cIMessageInteractions\u003e().CatchUnhandledExceptions(this);\n\n        // your code\n    }\n}\n```\n\n### FileInteractions\n```cs\n// Open\nvar file = await FileInteractions.OpenFileAsync(new OpenFileArguments\n{\n    SuggestedFileName = \"my.txt\",\n    Extensions = new[] { \".txt\" },\n    FilterName = \"My txt files\",\n});\nif (file == null)\n{\n    return;\n}\nvar text = await file.ReadTextAsync().ConfigureAwait(true);\n\n// Save (if you need to save file from previuos step)\nawait file.WriteTextAsync(text).ConfigureAwait(false);\n\n// Save As\nvar file = await FileInteractions.SaveFileAsync(new SaveFileArguments(\".txt\")\n{\n    SuggestedFileName = \"my.txt\",\n    FilterName = \"My txt files\",\n});\nif (file == null)\n{\n    return;\n}\nawait file.WriteTextAsync(text).ConfigureAwait(false);\n```\n\n### MessageInteractions\n```cs\nawait MessageInteractions.ShowMessageAsync(\"Message\");\nawait MessageInteractions.ShowWarningAsync(\"Warning\");\nawait MessageInteractions.ShowExceptionAsync(new InvalidOperationException(\"Exception\"));\nbool question = await MessageInteractions.ShowQuestionAsync(new QuestionData(\"Are you sure?\"));\n```\n\nWinUI requires a window to display the ContentDialog, so you'll need to set it explicitly in your App.OnLaunched:\n```cs\nprotected override void OnLaunched(LaunchActivatedEventArgs args)\n{\n#if HAS_WINUI\n    var window = new Window();\n    MessageInteractions.Window = window;\n#endif\n}\n```\n\n### WebInteractions\n```cs\nawait WebInteractions.OpenUrlAsync(\"https://www.google.com/\");\n```\n\n### DragAndDropExtensions\n```\n// WPF\nxmlns:dragAndDrop=\"clr-namespace:Mvvm.Interactions;assembly=Mvvm.Interactions.Wpf\" \n// UWP/Uno\nxmlns:dragAndDrop=\"using:Mvvm.Interactions\"\n```\n```xml\n\u003cElement\n    AllowDrop=\"True\"\n    dragAndDrop:DragAndDropExtensions.DragFilesEnterCommand=\"{Binding DragFilesEnter}\"\n    dragAndDrop:DragAndDropExtensions.DragTextEnterCommand=\"{Binding DragTextEnter}\"\n    dragAndDrop:DragAndDropExtensions.DragLeaveCommand=\"{Binding DragLeave}\"\n    dragAndDrop:DragAndDropExtensions.DropFilesCommand=\"{Binding DropFiles}\"\n    dragAndDrop:DragAndDropExtensions.DropTextCommand=\"{Binding DropText}\"\n    \u003e\n```\n\nCommand arguments:\nDragFilesEnterCommand - `FileData[]` - Array of files.  \nDragTextEnterCommand - `string` - Text.  \nDragLeaveCommand - `null`.  \nDropFilesCommand - `FileData[]` - Array of files.  \nDropTextCommand - `string` - Text.  \n\n## Contacts\n* [mail](mailto:havendv@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavendv%2Fmvvm.interactions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhavendv%2Fmvvm.interactions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavendv%2Fmvvm.interactions/lists"}