ALL SOFTWARE EXERCISES
- EXERCISES HOME PAGE (840)
- Access 2010 (66)
- Access VBA Macros (17)
- Advanced VBA (29)
- ASP.NET MVC (0)
- ASP.NET webforms - C# (25)
- ASP.NET webforms - VB (27)
- Excel 2010 (83)
- Excel 2013 (10)
- Excel VBA Macros (37)
- Power BI - Excel 2013 (25)
- Power BI - Excel 2016 (23)
- Power BI Desktop (26)
- PowerPivot 2010 (26)
- Report Builder 3.0 (42)
- SQL (156)
- SSAS - multidimensional (21)
- SSAS - tabular (29)
- SSIS Integration Services (18)
- SSRS Reporting Services (53)
- Visual Basic 2010 (42)
- Visual C Sharp 2010 (65)
- WPF - Visual C# (20)
WPF - VISUAL C# EXERCISES
Exercise: Create styles/resources to generate a playing card
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!
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 new window called Diamond. The aim of this exercise is to create a playing card, where the number and size of symbol can vary:
|50% scaling of Ace||200% scaling of Jack|
First create two window-level resources as follows:
- a String data type resource called CardSymbol, initially set to A; and
- a Double data type resource called SymbolReduction, initially set to 0.5.
Don't forget to reference the mscorlib namespace in your window, so the data types can work.
Now create a StackPanel within a Border (whose CornerRadius is set to 10, to produce the rounded corners), and put in this:
- a label whose content should equal the CardSymbol resource value; and
- a polygon with Points property equal to something like "20,0 0,20 20,40 40,20", and a ScaleTansform with ScaleX property set to the value of the SymbolReduction resource.
Try amending the resource values in your XAML, and check that you get different results as you would expect.
If you still have time, try combining styles and resources to get the core XAML of your window to be as clean as possible:
This is what the answer looks like!
Close any windows you have open.