Getting To Know WPF
Getting To Know WPF
Written by Ian Elliot   
Tuesday, 10 March 2015
Article Index
Getting To Know WPF
Why WPF? The Basic Controls
Buttons On The Edge Of A Nervous..




Notice that the Storyboard is now slightly more complicated as we have added Acceleration and Deceleration ratios which specify how the change speeds up and slows down and we have made it repeat forever and loop back to its original state.

Once you have the basic idea of animation you can discover most of what you need to know by experimentation. For example, to make the button move diagonally when the user clicks on it, add the following between the EventTrigger.Actions tag:

<EventTrigger RoutedEvent="Button.Click">
From="0.0" To="125.0"
AutoReverse="True" />
From="0.0" To="125.0"
AutoReverse="True" />

This moves the top and left properties and repeats the entire action just once. 

As you work with XAML it’s easy to forget that you are in fact working with a complete graphics system.

For example, all of the co-ordinates are in terms of absolute measurements rather than pixels and if the user interface is displayed on a higher resolution display device the quality increases, not the size of the text or buttons.

There are also transformations that you can apply to any rendered graphic. For example, if you add:

 <RotateTransform Angle="45" />

then the button will be drawn at 45 degrees – it still works as a standard button and even the animation functions. Animating a transformation is also possible.



Buttons just aren’t supposed to behave like this!


Now that you have seen how WPF works you should be able to explore most of its facilities with the help of the documentation. It’s a powerful and unified approach to Windows graphics and you can’t afford to ignore it.

The things to keep in mind is that WPF is built on DirectX and makes use it to render all its graphics. All of the WPF controls are full graphical objects and they are only special in that they use used to respond to user input. WPF includes more sophisicated features such as animation, 3D, data binding and more. 

If you would like the code for this project then register and click on CodeBin.


To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.  



Getting Started with WPF


WPF Windows Presentation Foundation is the new way to do forms and all things graphical in .NET. You can still use  Windows Forms but don't expect anything particularly new to be added to [ ... ]

Routed Events

Routed events were new in .NET 3.5 but there is still plenty to discover about using them. We look at bubbling and tunneling and how to create your own routed even and how WPF changes the underlying m [ ... ]

Custom Bitmap Effects - HLSL

In the article Custom Bitmap Effects - Getting started we discovered how to work with HLSL in WPF. Now we are in a position to write more sophisticated shaders and  this means learning some more  [ ... ]

FlexGrid - A Lightweight Data Grid

There are more data grids available than the standard one that comes with WPF. In this article we take a look at FlexGrid for WPF and discover how easy it is to use.

Custom Bitmap Effects - Getting started

The simplest possible custom effects project is enough for you to see how it all works and to move on to building your own effects that do something useful. This is an introduction to using HLSL in WP [ ... ]

Other Articles


blog comments powered by Disqus






public partial class Window1 : Window

Last Updated ( Tuesday, 10 March 2015 )

RSS feed of all content
I Programmer - full contents
Copyright © 2015 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.