Course C# Advanced including WPF, MVVM and SQL Database

Lesson 01 Tuesday June 2nd (08:30 – 12:00)

Homework to finish before Lesson 01
Perform the following assignment using Visual Studio 2019:
Exercise: Creating an Object Oriented System for Drawing Shapes using C#
If certain topics appear to be unclear, an explanation of the different object oriented concepts used in this exercise can be found here:

Class Time
During this first lesson we will get acquainted with each other and discuss the topics of the course.
We will use the homework exercise mentioned above to perform a thorough recap of the C# Fundamentals course to see where we all stand knowledge wise and skill wise.
These recap topics will be discussed as well:

1. Generics

2. Delegates

Lesson 02 Tuesday June 9th (08:30 – 12:00)

Homework to finish before this lesson
Perform the parts 5, 6, 7 and 8 using Visual Studio 2019.
Exercise: Creating an Object Oriented System for Drawing Shapes using C#
For the parts 6 and 7 this article might be handy:

Class Time
The second lesson will start with a discussion of the homework. Other topics during class time:

3. Performing Operations Asynchronously

Lesson 03 Tuesday June 16th (08:30 – 12:00)

Homework to finish before this lesson
Perform the parts 9 and 10 using Visual Studio 2019 of this exercise:
Exercise: Creating an Object Oriented System for Drawing Shapes using C#
If there is nothing else for you to watch on Netflix, you could check out Async programming deep dive by Bart De Smet.

Class Time

4. Creating a Windows Desktop Application using WPF

First released as part of .NET Framework 3.0 in 2006

5. Working with XML and XAML

6. Creating Modern and Advanced GUIs using WPF

Lesson 04 Tuesday June 23th (08:30 – 12:00)

Homework to finish before this lesson
Perform the parts 11, 12 and 13 of this exercise:
Exercise: Creating an Object Oriented System for Drawing Shapes using C#

Class Time

  • Homework Discussion
  • Visual Studio Tip of the Day: Vertical Selection + Editing
    it gets even better thanks to Karel’s tip 💡 Multi-line and multi-cursor editing
  • Some Key WPF Concepts
    • A Dependency Property is a property whose value depends on multiple sources, such as animation, data binding, styles, or visual tree inheritance. A Dependency Property also has the built-in feature of providing notification when the property has changed. Their values are not stored in the local object but (only changed) properties are stored in a dictionary of key/value pairs which is provided by the DependencyObject class.
    • Attached Properties are a special kind of Dependency Properties that are settable on a different object than the one that exposes it. An example of attached property is a StackPanel using DockPanel.Dock=”Top” or a Button using Canvas.Left=”120″.
  • Content Controls are controls that can contain a single item in their Content property. This can of course also be one of the panel controls…
    Below are some examples of Content Controls:
  • Examples of other types of controls can be found here
  • ItemsControls contain a collection of child objects. The ItemSource or Items property specifies the source collection of child objects.
    • 💡 If you specify a value for the ItemsSource property, the Items collection is made read-only and fixed-size, which means that you cannot add items to the collection directly.

    Below are some examples of ItemsControls:

    • ComboBox
    • ListBox
      👓 WPF101 > ItemControlEventsDemo
      👓 WPF101 > CSharpCodeInXAMLDemo
    • 💡 Example of how to display selected text from both ComboBox and ListBox in a Label:
    •       private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                if (myLabel != null)
                {
                    // Selector is a base class of both ComboBox and ListBox
                    // Both ComboBoxItem and ListBoxItem derive from ContentControl
                    myLabel.Content = ((sender as Selector)?.SelectedValue as ContentControl)?.Content.ToString();
                }
            }
            
  • WPF Resources
    👓 WPF101 > ResourcesDemo
    • Defining Resources by Using XAML
    • Defining Resources Programmatically
    • Referencing Resources in XAML
      • reference as StaticResource
      • reference as DynamicResource
      • The most common markup extensions used in WPF programming are those that support resource references (StaticResource and DynamicResource)

        💡 you could also paint using a Gradient Brush

  • Styles
    👓 WPF101 > StylesDemo
  • You can think of a style as a convenient way to apply a set of property values to more than one element

Lesson 05 Thursday July 2nd (08:30 – 12:00)

Homework to finish before this lesson
Complete the following assignment using Visual Studio 2019:
Exercise: Creating a Visual Solar System using WPF

Class Time

  • Homework Discussion
  • Visual Studio Tip of the Day: Run To Cursor
  • Control Templates
    👓 WPF102 > ControlTemplatesDemo
    👓 WPF102 > SeparateControlTemplateDemo
  • By setting the Template property to another instance of a Control Template, you can completely replace the appearance (visual tree) of a control.

    In many cases, Control Templates give you sufficient flexibility so that you do not have to implement your own Custom Controls

  • Routed Events
    👓 WPF102 > TunnelingAndBubblingDemo
    👓 WPF102 > RoutedEventsDemo
  • Routed events are events that can invoke handlers on multiple listeners in an element tree, instead of invoking them only on the object that raised the event. This behavior is largely invisible if you are handling an event on the element where it is raised, but becomes powerful if you use any of these scenarios: defining common handlers at a common root, compositing your own control, or defining your own custom control class.

  • Commands
  • Data Binding
  • Data Binding enables a clean separation of business logic from UI

    • Introduction
    • Binding Markup Extension
    • Data Binding Modes
      👓 WPF102 > BindingToControlsDemo
      💡 In general, user-editable control properties, such as those of text boxes and check boxes, default to two-way bindings, whereas most other properties default to one-way bindings.
      • OneWay
      • TwoWay
      • OneWayToSource
      • OneTime

Lesson 06 Tuesday July 7th (08:30 – 12:00)

Homework to finish before this lesson
Complete parts 6 and 7 of our solar system assignment:
Exercise: Creating a Visual Solar System using WPF

Class Time

  • Homework Discussion
  • Visual Studio Tip of the Day: C# Interactive Window
  • DataContext
    • Specify the Binding Source using C# (via Code Behind)
      👓 WPF103 > BindingToSingleObjectDemo
    • Specify the Binding Source using XAML
      👓 WPF103 > BindingToSingleObjectDemoXAMLTwoStep
      👓 WPF103 > BindingToSingleObjectDemoXAMLOneStep
  • The UpdateSourceTrigger Property
    👓 WPF103 > UpdateSourceTriggerDemo
  • Property Change Notification
  • Converting Data

Lesson 07 Tuesday July 14th (08:30 – 12:00)

Homework to finish before this lesson
Complete parts 8 and 9 of our solar system assignment:
Exercise: Creating a Visual Solar System using WPF

Class Time

Lesson 08 Tuesday July 21th (08:30 – 12:00)

Homework to finish before this lesson
Complete parts 10, 11, 12, 13, 14, 15, 16 and 17 of our solar system assignment:
Exercise: Creating a Visual Solar System using WPF

Class Time

  • Homework Discussion
  • Visual Studio Tip of the Day:
  • Binding to Collections
    • 👓 WPF105 > SelectedValuePathDemo
    • 👓 WPF105 > BindingToACollectionDemo
    • Observable Collections
      💡 ObservableCollection(T) implements INotifyCollectionChanged to provide notifications when items are added or removed or the whole collection is changed. When a control is bound to an ObservableCollection, WPF automatically adds a CollectionChanged event handler to that ObservableCollection’s events.
      💡💡 Each object in the collection must implement INotifyPropertyChanged. Otherwise changes to individual object properties are not broadcasted.
      👓 WPF105 > ObservableCollectionDemo
      👓 WPF105 > ObservableCollectionDemoXAML
      • 💡 this demo also uses a so-called ObjectDataProvider
      • An ObjectDataProvider allows us to specify a method name, pass arguments and invoke it from XAML

    • Collection Views
      💡 A Collection View is a wrapper around a collection that enables sorting, filtering and grouping without manipulating the underlying source collection. All collections have an associated default collection view. The binding engine always accesses the collection by using the associated view.
      👓 WPF105 > CollectionViewDemo
    • Data Templates
      👓 WPF105 > DataTemplateComboBoxDemo
      The ListView control makes heavy use of DataTemplates.
      💡 the _Starter.xaml file in every 👓 WPF10x demo solution contains both a Collection View and a Data Template
  • Showing Sample Data while Designing
  • Appendix: Summary of WPF Class Hierarchy

7. The Model-View-ViewModel (MVVM) Software Architectural Pattern

  • What Wikipedia has to say
  • Introducing the MVVM Pattern
  • Getting started with MVVM WPF
  • Fundamental equation of MVVM: View.DataContext = ViewModel
    also called ‘Marrying the View and the ViewModel’

  • Commands Revisited
  • All user controls that implement the ICommandSource interface (e.g. Buttons, MenuItems) support a Command property that will be invoked when the control’s default action occurs.

    Commands are simply objects that implement the ICommand interface. Or, put another way, Commands are messages from the View to your View Model


    BEWARE! everything below is still WORK IN PROGRESS


    8. How to Create Graphs and Charts in WPF

    9. Introduction to Databases and SQL

    10. How to Design a Relational Database

    11. Implementing a database using Microsoft SQL Server 2014

    12. Perform Create/Read/Update/Delete (CRUD) Operations on SQL Server

    13. Language-Integrated Query (LINQ)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s