/WPFCrudControl

A generic WPF CrudControl implemented based on the MVVM pattern. The control abstracts both the UI and business logic to achieve a foundation for a complete CRUD operation implementation (Add, Edit, Delete, Listing with sorting, paging and searching).

Primary LanguageC#MIT LicenseMIT

WPFCrudControl

A generic WPF CrudControl implemented based on the MVVM pattern. The control abstracts both the UI and business logic to achieve a foundation for a complete CRUD operation implementation (Add, Edit, Delete, Listing with sorting, paging and searching).

The Result

![alt text](https://cloud.githubusercontent.com/assets/20560529/20644314/ec3c0a98-b438-11e6-9fad-3d7f4b1747d7.png)

Xaml usage

<crud:GenericCRUDControl>
    <crud:GenericCRUDControl.SortingProperties>
        <crud:SortingProperty DisplayName="Product Name" PropertyPath="ProductName">
        </crud:SortingProperty>
        <crud:SortingProperty DisplayName="Category" PropertyPath="Category.CategoryName">
        </crud:SortingProperty>
        <crud:SortingProperty DisplayName="Supplier" PropertyPath="Supplier.ContactName">
        </crud:SortingProperty>
    </crud:GenericCRUDControl.SortingProperties>
    <crud:GenericCRUDControl.Columns>
        <crud:CustomDataGridColumn Header="Category Name" BindingExpression="Category.CategoryName">
        </crud:CustomDataGridColumn>
        <crud:CustomDataGridColumn Header="Product Name" BindingExpression="ProductName">
        </crud:CustomDataGridColumn>
        <crud:CustomDataGridColumn ColumnType="TemplateColumn" Header="Stock">
            <crud:CustomDataGridColumn.DataGridColumnTemplate>
                <DataTemplate>
                    <ProgressBar Maximum="150" Value="{Binding UnitsInStock}"></ProgressBar>
                </DataTemplate>
            </crud:CustomDataGridColumn.DataGridColumnTemplate>
        </crud:CustomDataGridColumn>
        <crud:CustomDataGridColumn Header="Supplier Name" 
         BindingExpression="Supplier.ContactName" Width="*"></crud:CustomDataGridColumn>
    </crud:GenericCRUDControl.Columns>
</crud:GenericCRUDControl>

Getting Started

Installation using Nuget 

WPF CrudControl is available on NuGet, you can install it using nuget manager or run the following command in the package manager console.

PM> Install-Package WPFCRUDControl

For the getting-started details got to the CodeProject Article

Solution Design

generic crud For the solution design details got to the CodeProject Article

Northwind Demo

The solution is applied on Northwind database for two modules Suppliers and Products. In the demo, we used Unity as a IoC/DI container, MVVMLight toolkit and WPF Modern UI library for styling the main window and navigation.

To run the demo:

  • Restore packages using NuGet packages manager
  • Install SQL Server LocalDB