Tag Archive for WPF

MCTS 70-511 Passed and Advice

A few weeks ago i was pleased to have passed the 70-511 exam! I took the test at Devrill PLC in Poole which a great test centre except perhaps the creaky mice.

The reason i write this blog post is not to just brag about passing but to give some advice to all those who are revising for the test.

The book

If you havent brought the training kit book for this exam, then you really should! The book is really usefull for introducing you to the basic concepts your need to know. I deffently recommend that you do the suggested practises as these get you working with WPF and its the kind of practical experience that the exam is looking for.

The book also includes on the disc a mock test application that allows you to take mock exams to see how your progressing. BE AWARE the questions in the practise tests are rather basic so dont solely rely on the tests as a way of checking your progress.

MSDN

Although the training kit is useful, its not perfect. i found a few areas that the exam might cover that were not even mentioned in the book. This is where MSDN comes in! When you finsh a mock test, you are given the awnsers and with those answers are links to the MSDN site. CLICK THESE! they go into the level of depth that your need for the exam. The way i managed these links was to create a live folder in firefox. then i would put al the links in the folder and slowly work my way through reading them, once i read one i would remove it.

Link: MSDN Website

Measure Up tests

Although you get some mock test software with the training kit, the questions are rather basic and do miss a few areas that may be covered by the exam. I purchased the Measure Up tests software and im rather glad i did. These tests are a lot more detailed with a lot more detailed explinations and better quality links to more information.

Link: Measure Up 70-511 test software

The test

I shall confess, i failed my first attempt of the test. I believe this happened because i didnt proceed to check through the questions a secoud time. When i retook the exam i proceeded to run through all the questions agian. While doing this i noticed how some questions i had answerd were incorrect so i proceeded to change them. My secound point is TAKE YOUR TIME. you really get plenty of time so there is no need to rush.

 

Well i wish all those fellow test takers all the luck!

5 Cool WPF features for WinForms Devs

Today i have finally booked my exam for the MCTS 70-511. Booking the exam made me reflect and just how much i had discovered about WPF since starting to revise for the exam. When i started, i had only had around a year experience with WinForms and C# and around 0 weeks of WPF development.  So here are 10 things i have discovered for anyone else who might be still working with WinForms.

 

1. XAML, XAML, XAML!

With WinForms you have two choices, you can use the interface designer and drag and drop components into your form or you can create and configure your components in code. Which ever one of those you choose, it will chuck up some C# in a class somewhere. Then WPF comes along looking all pretty with its XAML code. XAML is very similar to HTML in the sense you have elements and a hierarchy. If you have worked with something like android development this kind of XML/HTML style interface design will be familiar.

Why its cool:  Its Cool because it gives you much more control and structure to your interface. More importantly it makes increasingly readable layout code.

Find out more at: XAML Overview (WPF)

 

2. Control Templates, Gray is so last year!

When working with WinForms, if you want to customize the way a control (e.g. a button) looks you are only really faced with changing simple properties like the foreground, background, font etc. WPF has changed all that, with control templates you can visually change the control completely. You can choose what your control will show and how it will do it, you can place other controls within your control, e.g. placing a checkbox within a button.

Why its Cool: No more boring gray controls, you can make controls look however you want and its pretty simple to do.

Find out more: Customizing the Appearance of an Existing Control

 

3. Data Binding, The best of WPF by far

It would be a terrible crime not to talk about Data Binding when talking about WPF. Once you start using Data Binding your wonder why you spend so long writing endless SQL statements in click events. The idea of Data binding is to take away a lot of the pain of updating your source when you make a change in your application. Data binding will with a little encouragement detect when a user changes a field in your UI and will then proceed to update that value within your object which will more then likely be in a collection which will also be notified of the change. This means instead of having code all over the place updating your source (for example SQL Update statements) you can just have simple update code within your object model (your class you use to create your Customer Object for example) that does all the magic.

Why its Cool: It will save you a fair chunk of time doing boring update code. I also find it forces you into using OO design which can only be a good thing.

Find out more: Data Binding Overview

 

4. ClickOnce, Deployment without the hassle.

I know what your thinking, “you can deploy WinForms applications with ClickOnce”. That is correct but i don’t think it gets the attention its due so i am giving it 5 minutes of fame. If you have ever had to deploy your application to more then a few people, you would of had to create an installer. Unless your a programming God you would properly have to send out a new version of your application to fix some bugs. This can be painful, sometimes users might not of got the memo, some users might be scared to death of Installers after they opened that questionable attachment in their emails. ClickOnce may not be very configurable but it does offer a massive time safer. A integrated Updating functionality. With ClickOnce you can set a minimum required Version, you can get the application to check for updates when the app is opened or when the user exits. You can even create check for updates functionality within your application.

Why its cool: It makes updating your user base much much easier. This will save you a lot of time. It can also automatically publish itself to your FTP or network location.

Find Out more: ClickOnce Deployment Overview

 

5. Resource Dictionaries, CSS for .NET

XAML allows you to create styles and brushes. So what? well resource dictionaries are a revolution in recycling. You can define all your styling information (what color your buttons background is, what size font to use) within a resource dictionary, you can then  reuse the resource dictionary not only within the same application but also if you place the resource dictionary in a separate Library you can then use those styles within other projects. This is pretty handy if you are likely to produce a number of applications that will share a consistent style as you only have to define the style once and all your applications will use the styling information. Resource dictionaries are also very versatile, you can set a style that will  automatically change every control of that type or you can give a resource a key and then reference that key within the controls you want to use the style.

Why its Cool: Its all about recycling, recycling saves time. what more do you want!

Find out more: Resources Overview

 

I hope that’s helped inspire those of you who are still using WinForms to move over to the WPF side.

Understanding MVVM using MVVM Light

I had come across MVVM a number of times in my WPF travels but only in the form of the letters on a screen, so like any budding software engineer i decided to investigate.

WTF IS MVVM?

This question is where i started and it was a question i struggled with,  It seams that most people who write about MVVM are unable to explaining it such a manor that simple folk like myself can understand. Here is what i understood after reading a number of explanations.

Its a method of designing software so that you can easily separate the layout from the data. Separating the data makes testing easier and allows you to see test data when designing your layout in tools like Expression Blend.

The letters do actually mean something:

Description of View, View-Model and Model of MVVM

M = Model

This refers to your classes that define your OO business objects, for example your Customer class with the customers properties like customer name etc. Nothing new here!

V = View

The view is very much your XAML code and that’s it! The view is your Window. each new window is a view.

VM = View Model

The view model is the bit that is perhaps more confusing. The view model loads your data using your model and then using bindings lets your view use that data for the user interface. The View Model is where your load in your data from the database and load it into BO defined in your Model.

 

The order of the letters of MVVM i find disjointed. if it was up to me (for many reasons its not) i believe it should be View View-Model Model or VVMM, doesn’t have the same ring does it?

That’s Wonderful dear, But were on earth do i start?

Well word on the street has it that, doing things MVVM style adds more code to the proceedings, but.. before you hit the back button, someone has already done the hard work for you! This comes in the form of MVVM Light. You can download MVVM Light as an installer (Install MVVM Light). MVVM Light consists of a small framework that just takes out some of the hard graft, so i am told. Once installed all you have to do is create a new project using one of the freshly installed templates within VS2010.

This MVVM Light, What do i do with it?

To get started with MVVM Light,  i recommend that you go to the MVVM Light site which have a few tutorials to get you going. The most useful i found was the video explaining MVVM and MVVM Light and also a nice simple tutorial can be found here.

I’m still getting used to MVVM Light so i shall likely have some more posts on it soon.