Switch On The Code RSS Button - Click to Subscribe
Oct
2

WPF Tutorial - Getting the DoubleClick Event

In WinForms, everything that derived from System.Windows.Forms.Control had the MouseDoubleClick event - and not suprisingly, in WPF, everything derived from System.Windows.Controls.Control also has a MouseDoubleClick event. But there is a key difference - in WinForms, almost everything that gets displayed on the screen is derived from System.Windows.Forms.Control in some way - while in WPF, there are a number of items you can put on the screen that do not actually derive from System.Windows.Controls.Control. So today we are going to take a look at how to get double clicks when you are not derived from System.Windows.Controls.Control.
 
Read More »

Posted in WPF, XAML, C#, All Tutorials | No Comments »

Sep
25

WPF Tutorial - Using The Built-In Commands

One of the features that WPF has is actually a blast from the past - something that MFC used to have, but was never included in WinForms. This is the concept of Commands. Commands are somewhat like events in that they are based on actions in the user interface, a command can [...]
 
Read More »

Posted in WPF, XAML, All Tutorials | No Comments »

Sep
16

WPF Tutorial - Using An ItemsPanel

One of the most useful things about WPF is how flexible all of the built in controls are. Don't like how the tabs look on a tab control? Restyle them! Need to have images inside your combo box? Sure, no problem! This flexibility extends deep into a number of controls, and today we are going to take a look at controlling layout in an ItemsControl by setting the ItemsPanel.
 
Read More »

Posted in WPF, XAML, C#, All Tutorials | No Comments »

Aug
20

XAML Tutorial - Changing Text Color on Mouse Over

I received a comment on an old Silverlight 1.1 post a while ago asking how to change the foreground of text when the user has moused over it. I could have pasted the solution as a reply in the comment, but I felt it deserved its very own tutorial.
 
Read More »

Posted in XAML, All Tutorials | No Comments »

Jul
22

WPF Snippet Tutorial - Aligning ListView Items

WPF is powerful. So powerful in fact, that sometimes it's hard to find styles and settings to make it do what you want. Aligning ListView items was one such example for me. This snippet tutorial will show you how to use a style to vertically and horizontally align the contents of ListView cells.
 
Read More »

Posted in WPF, XAML, C#, All Tutorials | 3 Comments »

Jul
21

WPF Tutorial - Using MultiBindings

If you've touched WPF at all, you've probably realized that bindings are an extremely important piece of the framework. We've talked about WPF bindings a number of times here at Switch On The Code (most recently in a post where we talked about Binding Converters) - and yet we have just barely scratched the surface of the world of bindings. Today, we are going to take a look at MultiBindings.
 
Read More »

Posted in WPF, XAML, C#, All Tutorials | No Comments »

Jul
16

WPF Tutorial - How To Use A DataTemplateSelector

DataTemplates are an extremely powerful part of WPF, and by using them, you can abstract all sorts of display code. However, there are times when they fall short - and initially when I was learning WPF I was disappointed by that. For instance, you only get to set one DataTemplate on an items control, and while that made sense, it felt limiting. What if I wanted to use different templates depending on the content of the item? Do I have to build all that logic into a single data template?
 
Read More »

Posted in WPF, XAML, C#, All Tutorials | 1 Comment »

Feb
28

WPF Tutorial - Using The ListView, Part 1

Many of the controls in WPF have a downright dizzying array of capabilities and features, due in large part to the composibility of all the components. The ListView control is a great example of this - the possibilities are almost endless. This series of tutorials on the ListView will hopefully make the space of possible options seem not quite as daunting.
 
Read More »

Posted in WPF, XAML, C#, All Tutorials | 8 Comments »

Feb
18

WPF Tutorial - Creating A Custom Panel Control

The world of WPF gives you an extreme amount of flexibility right off the bat - with things like styles, control templates, and the composability of almost anything, at first it seems like everything is right there at your fingertips. And while there is a lot immediately accessible, there are still cases where you have to get down into the nitty-gritty. Today we are going to take a look at how to create a WPF custom control - more specifically, a custom panel.The available panels in WPF are great (perhaps we will have a tutorial on how to use them all at some point in the future). But maybe you have a very specific need, and none of the panels quite work the way you want?
 
Read More »

Posted in WPF, XAML, C#, All Tutorials | 7 Comments »

Jan
18

The WPF Tab Control - Inside and Out

When it comes to the WinForm's Tab Control, there was a lot left to be desired. If you had to make major design changes, you were better off just writing one from scratch. The WPF Tab Control makes major strides in the right direction. This tutorial is going to introduce you to the tab control and demonstrate how to re-skin it look like how you want.
 
Read More »

Posted in WPF, XAML, All Tutorials | 25 Comments »

Jan
9

Creating Custom Shapes with XAML

I don't know if you've ever had to draw your own shapes before WPF, but if not, I can tell you it used to be a lot harder. You don't have to override the OnPaint function or listen for the Paint event anymore. You simply create a shape as if it were any other object and position it where you want it. WPF takes care of everything else.
 
Read More »

Posted in WPF, XAML, All Tutorials | 6 Comments »

Sep
4

Silverlight Tutorial - Color Animations

In this tutorial, I'm going to show you how to use Silverlight's Storyboard and ColorAnimation XAML tags to create custom color animations. Color animations are commonly used on input controls like buttons to give visual feedback that the cursor is over the control or when the button has been pressed. This tutorial will show a couple of simple examples that can easily be extended to complex controls and animations.
 
Read More »

Posted in Silverlight, XAML, All Tutorials | 5 Comments »

Jun
29

Creating Buttons with XAML and C#

XAML is a new XML based markup language developed by Microsoft to help developers quickly and easily create user interfaces for their WPF graphics API. This tutorial will demonstrate basic button design and functionality using XAML and C#.
 
Read More »

Posted in XAML, All Tutorials | 2 Comments »