Category: Design Patterns
A summary of SOLID Principles as implemented in the C# language.Useful link: https://code-maze.com/solid-principles/1. Single Responsibility PrincipleEvery class should have only one responsibility. Consider the class PersonalDetails whose responsibility is to …
Suppose you have a conditional statement such as a switch or if-else that performs various actions depending on an object’s type:It is often beneficial to try to avoid lengthy switch/if-else …
I have long been searching for a hard and fast way of navigating between views in an MVVM / WPF environment.For some time I have been using ways that either …
For the Java equivalent see this link:https://www.technical-recipes.com/2017/applying-the-2-opt-algorithm-to-traveling-salesman-problems-in-java/For the C++ equivalent see this link:https://www.technical-recipes.com/2012/applying-c-implementations-of-2-opt-to-travelling-salesman-problems/This post demonstrates how to apply the 2-opt algorithm to a number of standard test problems in C# …
As discussed on a StackOverflow post, this is considered bad practice, so only use this when necessary.Step 1: Create a new WPF projectStep 2: Add event handling codeA number of …
Step 1: Create a new Visual Studio projectStep 2: Add the necessary Unity referenceSelect Tools > NuGet Package Manager.Type in the following command:Unity website for NuGet can be found here:https://www.nuget.org/packages/Unity/Step …
Example scenario: User clicks the mouse in a WPF application – how do we ‘listen’ to that event in order to trigger and handle an event in the main code? …
Some instructions on how to use the Mediator design pattern as a means of allowing communication between ViewModel classes in your MVVM / WPF application.In this example I use the …
Some few tips and instructions on how to bind data items contained in a List to a WPF ListView.Create a new empty WPF Application:Then create a new ViewModel class for …
A step-by-step guide to using the RelayCommand class (based on ICommand) as means of handling user-initiated events in WPF / MVVM / XAML. 1. Create a new WPF application2. Add …