{"id":21722901,"url":"https://github.com/calabonga/calabonga.wpf.mvvm.zones","last_synced_at":"2026-02-10T17:01:48.396Z","repository":{"id":257800810,"uuid":"861568104","full_name":"Calabonga/Calabonga.Wpf.Mvvm.Zones","owner":"Calabonga","description":"Zones for UserControl binding fot WPF application with MVVM. It's like Regions in the Prism framework, but very simple.","archived":false,"fork":false,"pushed_at":"2025-01-15T08:06:08.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-01T17:18:13.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Calabonga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"custom":"https://www.calabonga.net/site/thanks"}},"created_at":"2024-09-23T06:30:28.000Z","updated_at":"2025-05-15T16:26:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a6e786a-ad10-4bdc-9939-25ec759f0c8f","html_url":"https://github.com/Calabonga/Calabonga.Wpf.Mvvm.Zones","commit_stats":null,"previous_names":["calabonga/calabonga.wpf.mvvm.zones"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Calabonga/Calabonga.Wpf.Mvvm.Zones","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calabonga%2FCalabonga.Wpf.Mvvm.Zones","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calabonga%2FCalabonga.Wpf.Mvvm.Zones/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calabonga%2FCalabonga.Wpf.Mvvm.Zones/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calabonga%2FCalabonga.Wpf.Mvvm.Zones/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Calabonga","download_url":"https://codeload.github.com/Calabonga/Calabonga.Wpf.Mvvm.Zones/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calabonga%2FCalabonga.Wpf.Mvvm.Zones/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29308869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T16:09:25.305Z","status":"ssl_error","status_checked_at":"2026-02-10T16:08:52.170Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-26T02:34:21.091Z","updated_at":"2026-02-10T17:01:48.325Z","avatar_url":"https://github.com/Calabonga.png","language":"C#","funding_links":["https://www.calabonga.net/site/thanks"],"categories":[],"sub_categories":[],"readme":"# Calabonga.Wpf.Mvvm.Zones\nZones is for UserControl binding for WPF application with MVVM. It's like Regions in the Prism framework, but more simple.\n\n# How to use\n\nThere are a few simple steps:\n\n1. Install nuget-package [`Calabonga.Wpf.Mvvm.Zones`](https://www.nuget.org/packages/Calabonga.Wpf.Mvvm.Zones/)\n2. On the XAML where your zone will be use add namespace:\n    ```diff\n    \u003cWindow x:Class=\"Calabonga.Wpf.MvvmMdi.Views.MainWindow\"\n            xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n            xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n            xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n            xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n            xmlns:local=\"clr-namespace:Calabonga.Wpf.MvvmMdi\"\n    +       xmlns:zones=\"clr-namespace:Calabonga.Wpf.Mvvm.Zones;assembly=Calabonga.Wpf.Mvvm.Zones\"\n            xmlns:core=\"clr-namespace:Calabonga.Wpf.MvvmMdi.Core\"\n            mc:Ignorable=\"d\"\n            WindowStartupLocation=\"CenterScreen\"\n            Title=\"{Binding Title}\" Height=\"600\" Width=\"800\" Icon=\"/logo.png\"\u003e\n    ```\n3. Create a markup in your page. For example, I've created two controls with zone names `MainZone` and `DetailsZone`.\n   \n   ```diff\n   \u003cDockPanel VerticalAlignment=\"Stretch\" HorizontalAlignment=\"Stretch\"\u003e\n        \u003cStackPanel DockPanel.Dock=\"Top\"  Orientation=\"Horizontal\" HorizontalAlignment=\"Center\"\u003e\n            \u003c!-- skipped markup for brevity --\u003e\n        \u003c/StackPanel\u003e\n\n   +    \u003cContentControl DockPanel.Dock=\"Left\" Width=\"400\" zones:Zones.ZoneName=\"MainZone\"   /\u003e\n   +    \u003cContentControl Width=\"400\" zones:Zones.ZoneName=\"DetailsZone\" /\u003e\n\n    \u003c/DockPanel\u003e\n   ```\n\n4. Now we are ready to create some csharp objects. First of all we need views for Zone inherited from `IZoneView`:\n    ```csharp\n    public interface IMainZoneView : IZoneView { }\n\n    public interface IDetailsZoneView : IZoneView { }\n    ```\n    We should also create a views using this interfaces. For example for `IMainZoneView`:\n\n    ```csharp\n        /// \u003csummary\u003e\n        /// Interaction logic for MainZoneView.xaml\n        /// \u003c/summary\u003e\n        public partial class MainZoneView : UserControl, IMainZoneView\n        {\n                public MainZoneView()\n                {\n                        InitializeComponent();\n                }\n        }\n    ```\n\n    Then we need to viewModels for Zone inherited from `IZoneViewModel`:\n\n    ```csharp    \n    public interface IMainZoneViewModel : IZoneViewModel { }\n\n    public interface IDetailsZoneViewModel : IZoneViewModel { }\n    ```\n\n    We should also create a viewModels using interfaces. Example:\n    ```csharp\n        public partial class MainZoneViewModel : ZoneViewModelBase, IMainZoneViewModel\n        {\n                //skipped markup for brevity        \n        }\n    ```\n5. Register ZoneManager in your Dependency Injection Container:\n    ``` diff\n    + services.AddZones();\n    ```\n6. Register your modules Views ans ViewModels interfaces in Dependency Injection Container:\n   \n   ```diff\n   + services.AddScoped\u003cIMainZoneView, MainZoneView\u003e();\n   + services.AddScoped\u003cIMainZoneViewModel, MainZoneViewModel\u003e();\n   + services.AddScoped\u003cIDetailsZoneView, DetailZoneView\u003e();\n   + services.AddScoped\u003cIDetailsZoneViewModel, DetailsZoneViewModel\u003e();\n   ```\n7. Inject `ZoneManager` into your main ViewModel:\n   ```csharp\n    public MainWindowViewModel(IZoneManager zoneManager, IVersionService versionService)\n    {\n        Title = $\"WPF with MVVM (v{versionService.Version})\";\n        _zoneManager = zoneManager;\n    }\n   ```\n8. Now you can open your components in the zones you want. For example, in the registered zones `MainZone` and `DetailsZone`:\n   ```csharp\n    [RelayCommand]\n    private void OpenMain()\n    {\n        _zoneManager.ActivateZone\u003cIMainZoneView, IMainZoneViewModel\u003e(\"MainZone\");\n    }\n\n    [RelayCommand]\n    private void OpenDetails()\n    {\n        _zoneManager.ActivateZone\u003cIDetailsZoneView, IDetailsZoneViewModel\u003e(\"DetailsName\");\n    }\n   ```\n## Demo\n\nYou can find in this repository a `demo` project from where this snippets used.\n\n### CommunityToolkit Messaging\n\nDoubleClick on text in the Detail zone will send a message to the module in Main zone and to the Shell (see in window title).\n\n\u003cimg width=\"640\" alt=\"double-click\" src=\"https://github.com/user-attachments/assets/0d4e68d4-3b0b-42f9-91ea-76406eface6c\"\u003e\n\n### Remove module\n\nDoubleClick on tne text in the Main zone will remove it self from zone where it opened.\n\u003cimg width=\"640\" alt=\"double-click-close\" src=\"https://github.com/user-attachments/assets/d388d98b-1282-406b-8f81-7aeada36f7c8\"\u003e\n\n## History \n\n### 1.0.1 2024-10-21\n\nIMvvmObjectFactory added to dependency injection registration fixed.\n\n### 1.0.0 2024-09-26\n\nFirst release","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalabonga%2Fcalabonga.wpf.mvvm.zones","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalabonga%2Fcalabonga.wpf.mvvm.zones","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalabonga%2Fcalabonga.wpf.mvvm.zones/lists"}