@manhng

Welcome to my blog!

Chess Program in C#

January 18, 2022 00:41

Chess Program in C# (edit)

  • Test Driven Development
  • Unit Testing
  • WPF
  • .NET Framework 4.8
  • .NET Core 6.0

Test Driven Development Process with XUnit - CodeProject

Chess Program in C# - CodeProject

WPF

October 18, 2021 16:33

WPF (edit)

  • WPF Desktop Application
  • MVVM Architecture Pattern
  • Observer Pattern
  • Factory Pattern
  • Command Pattern
  • Dependency Injection Pattern
  • Event Aggregator Pattern
  • Façade Pattern
  • Inversion of Control Pattern
  • Repository Pattern

WPF:

C# - Implementing a log viewer with WPF - Stack Overflow

WPF Source Code Samples: bstollnitz/old-wpf-blog: A selection of posts from my old WPF blog. (github.com)

Dan Crevier's Blog | Microsoft Docs

Tales from the Smart Client | Microsoft Docs

Patterns - WPF Apps With The Model-View-ViewModel Design Pattern | Microsoft Docs (HAY HAY HAY)

Prism: Patterns For Building Composite Applications With WPF | Microsoft Docs (HAY HAY HAY)

Advantages and disadvantages of M-V-VM | Microsoft Docs

Data and WPF: Customize Data Display with Data Binding and WPF | Microsoft Docs

Advanced WPF: Understanding Routed Events And Commands In WPF | Microsoft Docs

RIATasks: A Simple Silverlight CRUD Example (using View Model) - CodeProject

From Russia with Love – Retrieving ViewModel Objects from a Model Assembly - CodeProject

Reed Copsey, Jr.

Better User and Developer Experiences – From Windows Forms to WPF with MVVM : Reed Copsey, Jr.

Better User and Developer Experiences – From Windows Forms to WPF with MVVM: Part 7, MVVM : Reed Copsey, Jr.

Advanced MVVM | Josh Smith on WPF (wordpress.com)

Josh Smith on WPF | Thoughts about the Windows Presentation Foundation (wordpress.com)

WPF & MVVM:

MVVM Tutorial from Start to Finish (software-architects.com)

Sujith's Blog - Building applications with WPF, MVVM and Prism (aka CAG) (asp.net) (HAY HAY HAY)

Developer's Guide to Microsoft Prism Library 5.0 for WPF | Microsoft Docs (HAY HAY HAY)

Download Prism 5.0 for WPF - Book Download from Official Microsoft Download Center

What's New in Prism Library 5.0 for WPF | Microsoft Docs

UI Composition | Microsoft Docs (design pattern)

Patterns in the Composite Application Library | Microsoft Docs (design pattern)

Prism 4.1 - Developer's Guide to Microsoft Prism Library for WPF and Silverlight | Microsoft Docs (HAY HAY HAY)

XAML & Silverlight:

Dr. WPF (drwpf.com)

MVVM Pattern using the Prism:

PrismLibrary/Prism: Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Xamarin Forms, and Uno / Win UI Applications.. (github.com)

Implementing the MVVM Pattern Using the Prism Library for WPF | Prism

Advanced MVVM Scenarios Using the Prism Library for WPF | Prism

Composing the User Interface Using the Prism Library for WPF | Prism

Prism Library 5.0 for WPF – Triển khai mô hình MVVM | Phạm Duy Anh (duyanhpham.com)

WPF Samples:

A simple concretization of MVVM pattern (c-sharpcorner.com)

MVVM Pattern Using WPF in Visual Studio 2012 (c-sharpcorner.com)

WPF MVVM Pattern: A Simple Tutorial for Absolute Beginners (c-sharpcorner.com)

Getting Started: MVVM Pattern Using Prism Library in WPF (c-sharpcorner.com)

Windows Presentation Foundation (WPF) is a UI framework that creates desktop client applications. The WPF development platform supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, documents, and security.

MVVM Architecture Pattern:

MVVM hỗ trợ cơ chế two-way binding giữa View và ViewModel. Điều này cho phép tự động đồng bộ các thay đổi giữa 2 thành phần. Nhìn chung, ViewModel tối ưu sử dụng pattern Observer để thông báo sự thay đổi trong ViewModel sang Model.

Model:

Model bao gồm một tập hợp các class mô tả nghiệp vụ của ứng dụng, các đối tượng làm việc trong ứng dụng và các class truy cập dữ liệu. Nó cũng định nghĩa các quy tắc nghiệp vụ để dữ liệu có thể được sửa và thao tác ra sao.

View:

View hiển thị các thành phần giao diện người dùng như CSS, jQuery hay HTML…View hiển thị dữ liệu được nhận về từ controller như là đầu ra. Đây cũng là nơi thay đổi dữ liệu của Model do người dùng nhập vào.

ViewModel:

ViewModel có trách nhiệm hiển thị các phương thức, các sự kiện và các hàm khác giúp cho việc bảo đảm trạng thái của View, việc thao tác trên Model là kết quả của các hành động trên View, và kích hoạt các sự kiện trên chính View.

EBook: Applied WPF 4 in Context.pdf

Apress/applied-wpf-4-in-context: Source code for 'Applied WPF 4 in Context' by Raffaele Garofalo (github.com)

Overview

MVVM Pattern in WPF: A Simple Tutorial for Absolute Beginners - CodeProject

A Practical Quick-start Tutorial on MVVM in WPF - CodeProject

MVVM Pattern Made Simple - CodeProject

WPF/MVVM Quick Start Tutorial - CodeProject

WPF: MVVM (Model View View-Model) Simplified - CodeProject

Architecting .NET Desktop and Mobile applications | DotNetCurry

Design patterns Tutorial => Model View ViewModel (MVVM) (riptutorial.com)

MVC vs MVVM: Key Differences with Examples (guru99.com)

Introduction of MVVM | (zkoss.org)

MVVM.jpg

Patterns in the Prism Library for WPF

Patterns in the Prism Library for WPF | Prism

MVVM Pattern with WPF Elements (mindscapehq.com)

Best Design Pattern for a WPF MVVM application - Stack Overflow

C# - MVVM pattern - Best design approach to manage an application - Software Engineering Stack Exchange

Sample composite application architecture with common patterns

Introduction of MVVM

MVVM[1] is an abbreviation of a design pattern named Model-View-ViewModel which originated from Microsoft.[2] It is a specialization of Presentation Model[3] introduced by Martin Fowler, a variant of the famous MVC pattern. This pattern has 3 roles: View, Model, and ViewModel. The View and Model plays the same roles as they do in MVC.

The ViewModel in MVVM acts like a special Controller for the View which is responsible for exposing data from the Model to the View and for providing required action and logic for user requests from the View. The ViewModel is type of View abstraction, which contains a View's state and behavior. But ViewModel should contain no reference to UI components and knows nothing about View's visual elements. Hence there is a clear separation between View and ViewModel, this is also the key characteristics of MVVM pattern. From another angle, it can also be said that the View layer is like an UI projection of the ViewModel.

Strength of MVVM

Separation of data and logic from presentation

The key feature is that ViewModel knows nothing about View's visual elements guarantees the one way dependency from View to the ViewModel thus avoiding mutual programming ripple effects between UI and the ViewModel. Consequently, it brings the following advantages:

  • It's suitable for design-by-contract programming. [4] As long as the contract is made (what data to show and what actions to perform), the UI design and coding of ViewModel can proceed in parallel and independently. Either side will not block the other's way.
  • Loose coupling with View. UI design can be easily changed from time to time without modifying the ViewModel as long as the contract does not change.
  • Better reusability. It will be easier to design different views for different devices with a common ViewModel. For a desktop browser with a bigger screen, more information can be shown on one page; while for a smart phone with limited display space, designing a wizard-based step-by-step operation UI can be done without the need to change (much of) the ViewModel.
  • Better testability. Since ViewModel does not "see" the presentation layer, developers can unit-test the ViewModel class easily without UI elements.

MVVM & ZK Bind

Since the ViewModel contains no reference to UI components, it needs a mechanism to synchronize data between the View and ViewModel. Additionally, this mechanism has to accept the user request from the View layer and bridge the request to the action and logic provided by the ViewModel layer. This mechanism, the kernel part of the MVVM design pattern, is either data synchronising codes written by the application developers themselves or a data binding system provided by the framework. ZK 6 provides a data binding mechanism called ZK Bind to be the infrastructure of the MVVM design pattern and the binder [5]plays the key role to operate the whole mechanism. The binder is like a broker and responsible for communication between View and ViewModel.

 

Mvvm-architecture.png

Detail Operation Flow

Here we use a simple scenario to explain how MVVM works in ZK. Assume that a user click a button then "Hello World" text appears. The flow is as follows:

SmallTalk MVVM HELLO FLOW.png

As stated in the paragraph earlier, the binder synchronizes data between UI and ViewModel.

  1. A user presses a button on the screen (perform an action).
  2. A corresponding event is fired to the binder.
  3. The binder finds the corresponding action logic (It is Command) in the ViewModel and executes it.
  4. The action logic accesses data from Model layer and updates ViewModel's corresponding properties.
  5. ViewModel notify the binder that some properties have been changed.
  6. Per what properties have been changed, the binder loads data from the ViewModel.
  7. Binder then updates the corresponding UI components to provide visual feedback to the user.

References

 

gtechsltn/WPF-Examples: WPF sample program based on Prism (github.com)

gtechsltn/WpfDemo: wpf常用控件自定义样式 (github.com)

ButchersBoy/Dragablz: Dragable and tearable tab control for WPF (github.com)

EntityFrameworkCore 工具命令行总结 - 痕迹g - 博客园 (cnblogs.com)

  • Windows Presentation Foundation (WPF)
  • Composite View design pattern
  • Presentation Model pattern
  • Supervising Controller Pattern
  • Event Aggregator pattern
  • Event-based Asynchronous Pattern
  • IAsyncResult pattern
  • Publish/Subscribe pattern
  • Model-View-Presenter (MVP) pattern
  • Model-View-ViewModel (MVVM) pattern

Architecture - WPF .NET Framework | Microsoft Docs

Windows Presentation Foundation | Microsoft Docs

WPF Globalization and Localization Overview | Microsoft Docs

WPF with MVVM – Easily Separate UI and Business Logic (clariontech.com)

MVVM Architecture (c-sharpcorner.com)

Simple Plugin Architecture Using Reflection With WPF Projects (c-sharpcorner.com)

Solution Architecture for a WPF Application

  • Patterns - WPF Apps With The Model-View-ViewModel Design Pattern
  • Patterns For Building Composite Applications With WPF

Excellent introduction to Model-View-ViewModel

https://msdn.microsoft.com/en-us/magazine/dd419663.aspx

Advantages and disadvantages of M-V-VM

Patterns - WPF Apps With The Model-View-ViewModel Design Pattern | Microsoft Docs

Prism: Patterns For Building Composite Applications With WPF | Microsoft Docs

UI Composition | Microsoft Docs

Publish/Subscribe | Microsoft Docs

MVVM QuickStart Using the Prism Library 5.0 for WPF | Microsoft Docs

5: Implementing the MVVM Pattern Using the Prism Library 5.0 for WPF | Microsoft Docs

6: Advanced MVVM Scenarios Using the Prism Library 5.0 for WPF | Microsoft Docs

State-Based Navigation QuickStart Using the Prism Library 5.0 for WPF | Microsoft Docs

View-Switching Navigation QuickStart Using the Prism Library 5.0 for WPF | Microsoft Docs

Upgrading from the Composite UI Application Block | Microsoft Docs

Event Aggregator | Microsoft Docs

Event Aggregation QuickStart | Microsoft Docs

Commanding QuickStart | Microsoft Docs

8: Navigation Using the Prism Library 5.0 for WPF | Microsoft Docs

Asynchronous Programming Model (APM) | Microsoft Docs (IAsyncResult pattern)

Event-based Asynchronous Pattern Overview | Microsoft Docs

gtechsltn/waf: Win Application Framework (WAF) is a lightweight Framework that helps you to create well structured XAML Applications. (github.com)

gtechsltn/ModernWpf: Modern styles and controls for your WPF applications (github.com)

gtechsltn/WPF-Samples: Repository for WPF related samples (github.com)

gtechsltn/Arthas-WPFUI: WPF 控件库,支持 .Net Core 3 + & .Net 4.6.2 + (github.com)

gtechsltn/WpfDemo: wpf常用控件自定义样式 (github.com)

gtechsltn/DMSkin (github.com)

gtechsltn/AduSkin (github.com)

gtechsltn/Hawk: visualized crawler & ETL IDE written with C#/WPF (github.com)

gtechsltn/FluentWPF: Fluent Design System for WPF. (github.com)

gtechsltn/WPF-UI-Design: WPF UI Design Example (github.com)

gtechsltn/Dragablz: Dragable and tearable tab control for WPF (github.com)

gtechsltn/HandyControl: Contains some simple and commonly used WPF controls (github.com)

gtechsltn/WPFArquitectureDemo: A simple solution which demonstrates a good (flexible) architecture for WPF applications, applying MVVM, Services, ServiceLocator. (github.com)

WinForms - @manhng (Windows Forms Application)

Welcome - The complete WPF tutorial (wpf-tutorial.com) (tài liệu tiếng Anh | Việt)

Window và XAML trong lập trình WPF | How Kteam (tài liệu tiếng Việt)

  • DataGrid (DataGrid site:wpf-tutorial.com)
  • TreeView (TreeView site:wpf-tutorial.com)
  • Report (Report site:wpf-tutorial.com)
  • Connection (Connection site:wpf-tutorial.com)
  • Menu (Menu site:wpf-tutorial.com)
  • Multi-threading with the BackgroundWorker (BackgroundWorker site:wpf-tutorial.com)
  • Handling exceptions (Handling exceptions site:wpf-tutorial.com)

Welcome - The complete WPF tutorial (wpf-tutorial.com)

Multi-threading with the BackgroundWorker - The complete WPF tutorial (wpf-tutorial.com)

Cancelling the BackgroundWorker - The complete WPF tutorial (wpf-tutorial.com)

Handling exceptions in WPF - The complete WPF tutorial (wpf-tutorial.com)

ListView

ListView with a GridView - The complete WPF tutorial (wpf-tutorial.com)

How-to: ListView with left aligned column names - The complete WPF tutorial (wpf-tutorial.com)

ListView grouping - The complete WPF tutorial (wpf-tutorial.com)

ListView sorting - The complete WPF tutorial (wpf-tutorial.com)

How-to: ListView with column sorting - The complete WPF tutorial (wpf-tutorial.com)

ListView filtering - The complete WPF tutorial (wpf-tutorial.com)

Panels

The Grid Control - The complete WPF tutorial (wpf-tutorial.com)

The Grid - Rows & columns - The complete WPF tutorial (wpf-tutorial.com)

The Grid - Units - The complete WPF tutorial (wpf-tutorial.com)

The Grid - Spanning - The complete WPF tutorial (wpf-tutorial.com)

The GridSplitter - The complete WPF tutorial (wpf-tutorial.com)

Using WPF commands

Using WPF commands - The complete WPF tutorial (wpf-tutorial.com)

Using the Grid: A contact form

Using the Grid: A contact form - The complete WPF tutorial (wpf-tutorial.com)

Using the Grid: ColumnDefinition and RowDefinition

Grid trong lập trình WPF | How Kteam (HAY HAY HAY)

+ Grid & ColumnDefinition & RowDefinition & ColumnSpan and RowSpan

+ Grid & GridSplitter & HorizontalAlignment

+ Grid & GridSplitter & VerticalAlignment

+ Grid & ScrollViewer & StackPanel

+ Thằng nào ra sau thì nằm trên (ghi đè)

WPF Dispatcher

The DispatcherTimer - The complete WPF tutorial (wpf-tutorial.com)

WPF Dispatcher - Introduction and How to use? (dotnetpattern.com)

# Centralised Event Dispatcher in C# - Part 1 - CodeProject

Debouncing and Throttling Dispatcher Events - Rick Strahl's Web Log (west-wind.com)

How to fire an event using Dispatcher.BeginInvoke in wpf - Stack Overflow

A Project Report In WPF (R-Office Management System) (c-sharpcorner.com)

MVVM Pattern Using WPF in Visual Studio 2012 (c-sharpcorner.com)

Categories

Recent posts