Week 7a - Graphical User Interfaces for C++ Applications

Windows Presentation Foundation and C++\CLI

Synopsis:

This lecture introduces Windows Presentation Foundation (WPF), a .Net Graphical User Interface technology. Its programming model is relatively simple and very powerful.
We combine this .Net-related material with C++\CLI, a .Net language that syntactically is close to C++, but builds to managed code. It has the extraordinary capability to interoperate with native C++ directly, even in the same code file. That's necessary to easily use WPF's managed code in an application based on C++'s native code.

Readings and Activities for the Week:

Glossary of Terms

  1. Projects:

  2. SVG demo

    This demo works with Chrome, FireFox, Edge, and IE11. It does not work with IE8 and earlier.

    SVG demo, SVG demo folder
    HTML5 demo

  3. WPF Presentation

  4. Demo code samples

    Demo Panels
    Illustrates how grid, canvas, dock, stack, and wrap panels work.

    Routed Event Demo
    Demonstrates event bubbling with Routed Events.

    Attached Properties Demo
    An example of attached properties used to dock buttons in a window.

    Triggers Demo
    Illustrates one use of triggers to change a textbox property.

    WPF Controls
    Shows how several of the most common kinds of controls are used. Includes use of data binding.

    Data Template Demo
    Data Templates are used to modify how data is displayed in WPF controls.

    Control Template
    Control templates can be used to modify the presentation of window controls.

    Bar Chart Demo
    Illustrates using rectangles to build a bar chart where each bar has a tooltip.

    WPF with all Code A WPF application can be built without using XAML. This demo illustrates how.

    Advanced Demos

    Change Notification
    Dispatcher Demo
    Message Hook
    Custom Element Demo

  5. WPF Tutorials:

  6. Managed C++\CLI and .Net Framework

    • (Managed) C++\CLI Presentation, pptx
      Discussion of C++\CLI syntax, semantics, and environment.
    • C++\CLI Demos
      Simple code demos focusing on interoperation.
    • C++\CLI Syntax Examples
      Several small examples of C++\CLI syntax you will need often.
    • WPF-Interop
      Simple demonstration showing how to interoperate between C++\CLI and native C++, using WPF. Note that you will be required to do this kind of interoperation for Projects #3 and #4.
  7. Preparation for Synchronous Discussion:

    • Using one of the tutorials, above, decide how you would layout a Client for Sample Project #4. Draw a sketch of the UI and be prepared to discuss.
  8. Lecture Take-aways:

    The most important things we discussed are: