All Projects → FantasticFiasco → Mvvm Dialogs

FantasticFiasco / Mvvm Dialogs

Licence: apache-2.0
Framework simplifying the concept of opening dialogs from a view model when using MVVM in WPF or UWP

Projects that are alternatives of or similar to Mvvm Dialogs

Windowscommunitytoolkit
The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building UWP and .NET apps for Windows 10. The toolkit is part of the .NET Foundation.
Stars: ✭ 4,654 (+1289.25%)
Mutual labels:  uwp, mvvm, wpf
Reactiveproperty
ReactiveProperty provides MVVM and asynchronous support features under Reactive Extensions. Target framework is .NET Standard 2.0.
Stars: ✭ 603 (+80%)
Mutual labels:  uwp, mvvm, wpf
Mvvmcross
The .NET MVVM framework for cross-platform solutions, including Xamarin.iOS, Xamarin.Android, Windows and Mac.
Stars: ✭ 3,594 (+972.84%)
Mutual labels:  uwp, mvvm, wpf
Catel
An application development platform
Stars: ✭ 616 (+83.88%)
Mutual labels:  uwp, mvvm, wpf
Reactivemvvm
Cross-platform ReactiveUI sample app built for a talk at MSK .NET conf.
Stars: ✭ 94 (-71.94%)
Mutual labels:  uwp, mvvm, wpf
Caliburn.micro
A small, yet powerful framework, designed for building applications across all XAML platforms. Its strong support for MV* patterns will enable you to build your solution quickly, without the need to sacrifice code quality or testability.
Stars: ✭ 2,404 (+617.61%)
Mutual labels:  uwp, mvvm, wpf
Waf
Win Application Framework (WAF) is a lightweight Framework that helps you to create well structured XAML Applications.
Stars: ✭ 539 (+60.9%)
Mutual labels:  uwp, mvvm, wpf
Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+1902.69%)
Mutual labels:  uwp, mvvm, wpf
Mvvmlight
The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in Xamarin.Android, Xamarin.iOS, Xamarin.Forms, Windows 10 UWP, Windows Presentation Foundation (WPF), Silverlight, Windows Phone.
Stars: ✭ 973 (+190.45%)
Mutual labels:  uwp, mvvm, wpf
Mvvmvalidation
Lightweight library that helps reduce boilerplate when implementing validation in XAML MVVM applications
Stars: ✭ 141 (-57.91%)
Mutual labels:  uwp, mvvm, wpf
Camelotia
Cross-platform .NET sample GUI app for cloud file management. Built with ReactiveUI, AvaloniaUI, Universal Windows Platform, Xamarin Forms, and WPF, runs on Windows, Linux, Mac and Android.
Stars: ✭ 221 (-34.03%)
Mutual labels:  uwp, mvvm, wpf
OrdersManagementSystem
Project demonstrates usage of Prism composition library, Material design library, SQL Server, Entity Framework in WPF application
Stars: ✭ 29 (-91.34%)
Mutual labels:  wpf, mvvm
ModernKeePass
KDBX password manager for the Windows Store
Stars: ✭ 29 (-91.34%)
Mutual labels:  uwp, mvvm
InplaceEditBoxLib
WPF/MVVM control to implement a textbox on top of other elements like TreeViewItem or ListViewItem (use case: perform in place edit on top of a displayed text item)
Stars: ✭ 28 (-91.64%)
Mutual labels:  wpf, mvvm
YouTube-Downloader
An easy-to-use, YouTube video downloader, without pesky ads or malware.
Stars: ✭ 22 (-93.43%)
Mutual labels:  wpf, mvvm
MvvmScarletToolkit
MvvmScarletToolkit is a personal project and framework to speed up the development process of xaml based applications using the viewmodel first approach
Stars: ✭ 23 (-93.13%)
Mutual labels:  wpf, mvvm
AppsTracker
Windows Application for tracking computer usage. C# + WPF + MVVM
Stars: ✭ 27 (-91.94%)
Mutual labels:  wpf, mvvm
DMSkin-Soft-Hide
隐藏软件&游戏的界面&任务栏图标&支持热键
Stars: ✭ 21 (-93.73%)
Mutual labels:  wpf, mvvm
GBCLV3
Goose Bomb's Minecraft Client Launcher
Stars: ✭ 50 (-85.07%)
Mutual labels:  wpf, mvvm
WPF-Keyboard-Control
WPF Keyboard Control
Stars: ✭ 53 (-84.18%)
Mutual labels:  wpf, mvvm


MVVM Dialogs
MVVM Dialogs

Framework simplifying the concept of opening dialogs from a view model when using MVVM in WPF or UWP.

Table of contents


Introduction

MVVM Dialogs is a framework simplifying the concept of opening dialogs from a view model when using MVVM in WPF (Windows Presentation Framework) or UWP (Universal Windows Platform). It enables the developer to easily write unit tests for view models in the same manner unit tests are written for other classes.

The framework has built in support for the following dialogs in WPF:

  • Modal window
  • Non-modal window
  • Message box
  • Open file dialog
  • Save file dialog
  • Folder browser dialog

The framework has built in support for the following dialogs in UWP:

  • Content dialog
  • Message dialog
  • Single file picker
  • Multiple files picker
  • Save file picker
  • Single folder picker

WPF usage

To open a modal window, decorate the view with the attached property DialogServiceViews.IsRegistered:

<UserControl
    x:Class="DemoApplication.Features.Dialog.Modal.Views.ModalDialogTabContent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:md="https://github.com/fantasticfiasco/mvvm-dialogs"
    md:DialogServiceViews.IsRegistered="True">

  ...

</UserControl>

With the view registered the view model is now capable of opening a dialog using the interface IDialogService:

public class ModalDialogTabContentViewModel : INotifyPropertyChanged
{
    private readonly IDialogService dialogService;

    public ModalDialogTabContentViewModel(IDialogService dialogService)
    {
        this.dialogService = dialogService;
    }

    ...

    private void ShowDialog()
    {
        var dialogViewModel = new AddTextDialogViewModel();

        bool? success = dialogService.ShowDialog(this, dialogViewModel);
        if (success == true)
        {
            Texts.Add(dialogViewModel.Text);
        }
    }
}

UWP usage

With UWP you don't need to register the view, simply open the dialog using the interface IDialogService:

public class MainPageViewModel : INotifyPropertyChanged
{
    private readonly IDialogService dialogService;

    public MainPageViewModel(IDialogService dialogService)
    {
        this.dialogService = dialogService;
    }

    ...

    private async void ShowContentDialog()
    {
        var dialogViewModel = new AddTextContentDialogViewModel();

        ContentDialogResult result = await dialogService.ShowContentDialogAsync(dialogViewModel);
        if (result == ContentDialogResult.Primary)
        {
            Texts.Add(dialogViewModel.Text);
        }
    }
}

Custom windows

Dialogs in WPF that doesn't inherit from Window, or content dialogs in UWP that doesn't inherit from ContentDialog, are called custom dialogs. These custom dialogs are supported, but in order for DialogService to know how to interact with them, you will have to implement the IWindow interface in WPF or IContentDialog in UWP.

Custom framework dialogs

MVVM Dialogs is by default opening the standard Windows message box or the open file dialog when asked to. This can however be changed by providing your own implementation of IFrameworkDialogFactory to DialogService.

More in the wiki

For more information regarding the concepts of MVVM Dialogs and extended samples on the subjects, please see the wiki.

Integration into other MVVM frameworks

For the benefit of all we aim to play nice with existing MVVM frameworks. Creating a new application can be daunting. Lots of decisions have to be made, and some are harder to correct than other. To help you on your way we've created a sample application using some of the popular MVVM frameworks existing today, to show you how you'd integrate MVVM Dialogs into that framework.

Currently the sample application is implemented using the following frameworks.

If your specific framework isn't among the listed, please create a new pull request and let us know.

MVVM Dialogs Contrib

The world is full of snowflakes and all applications are unique in some way. MVVM Dialogs takes no claim to solve all issues regarding dialogs, but is a fantastic solution for most applications. The rest, the applications deviating from the common path, may require specific changes to the behavior of MVVM Dialog. For those there is MVVM Dialogs Contrib. A repository with features and functionality developed by the open source community, solving very specific needs.

If MVVM Dialogs for some reason doesn't fit your application, raise an issue in MVVM Dialogs Contrib and we'll see what we can do. These features are always implemented by the community, but shepherded by the maintainers of MVVM Dialogs.

Install MVVM Dialogs via NuGet

If you want to include MVVM Dialogs in your project, you can install it directly from NuGet.

To install MVVM Dialogs, run the following command in the Package Manager Console:

PM> Install-Package MvvmDialogs

History

MVVM Dialogs started out as an article on CodeProject with its first revision published in May 2009. At that time MVVM was still new and fresh, and the now hugely popular MVVM Light had yet not been published. In fact, none of the MVVM libraries commonly used today existed back then. MVVM Dialogs came about out of necessity to work with dialogs from the view model, a reaction to the fact that although MVVM was a popular pattern, the support to implement it was rather limited.

So, the initial publication was over 10 years ago. Give that a thought. An open source project that after 10 years still is maintained and extremely relevant with the release of .NET Core 3. Take that all you out there claiming open source code is volatile!

MVVM Dialogs anniversary

Hip hip hooray!

Reputation

MVVM Dialogs has earned enough reputation to be listed on Awesome .NET!, in company with other awesome MVVM libraries.

Credit

Thank you JetBrains for your important initiative to support the open source community with free licenses to your products.

JetBrains

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].