Exercise: Create menus and a toolbar to change a gradient brush

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

The answer to the exercise will be included and explained if you attend the Wise Owl course listed below!

Category ==> WPF - Visual C#  (20 exercises)
Topic ==> Menus and toolbars  (1 exercise)
Level ==> Average difficulty
Course ==> WPF using Visual C#
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Create a window called winMenus, and create as many of the following components as you have time for!

First menu of system

The first menu gives you a choice of colours for the first linear gradient stop (you might want to leave making the checking of menu items mutually exclusive until the end, as this is tricky).


See overleaf for how the second menu works.

The second menu works in exactly the same way:

Second menu with colour chosen

Here we've chosen a red colour for the second half of the linear gradient brush.


Still bored?  Why not add the toolbar using the icons in the folder at the top of this exercise:

Toolbar of colours

If you click on a tool, it makes every gradient stop the same colour.


Still bored?  You could add a right-mouse button menu (context menu) for the rectangle (this isn't, however, included in the answer - you may not be bored ...).

This page has 0 threads Add post