.NET 3.0

WPF - The BasedOn Style Property


Posted in:

By this point, everybody knows and (mostly) loves styles in WPF. They give you the ability to customize and control from a high level - letting you abstract out the look of a control from the actual instantiation of a control. At this point I don't know how many times I've heard WPF styles referred to as "CSS, but for your application!" - and in many ways, that statement is right (although the cascading bit in WPF doesn't always work as well as CSS). Today we are going to take a look at a property of styles that can give you even more power to abstract away how your application looks - the BasedOnProperty.

Read More Icon Read More

XAML Tutorial - Changing Text Color on Mouse Over


Posted in:

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 Icon Read More

WPF Snippet Tutorial - Aligning ListView Items


Posted in:

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 Icon Read More

WPF Tutorial - Using MultiBindings


Posted in:

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 in the world of bindings. Today, we are going to take a look at MultiBindings.

Read More Icon Read More

WPF Tutorial - How To Use A DataTemplateSelector


Posted in:

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 Icon Read More

WPF Tutorial - Binding Converters


Posted in:

I'm going to come right out and say it, binding converters are one of the nicest pieces of WPF I've run across so far. Simply put, they provide a translation between your binding source and destination. The most common use I've found is when I'm binding to user interface elements, because on many occasions I don't store something in a data member that can just be stuck on the screen. This tutorial will provide an introduction to what binding converters are and how to use them.

Read More Icon Read More

Working With The WPF Dispatcher


Posted in:

Proper use of threads can greatly increase the responsiveness of your WPF applications. Unfortunately, you can't update any UI controls from a thread that doesn't own the control. In .NET 2.0, you used Control.Invoke(). Now, we've got something similar but more powerful - the Dispatcher. This tutorial will explain what the Dispatcher is and how to use it.

Read More Icon Read More

WPF Tutorial - Using WPF In WinForms


Posted in:

A little while back, we did a tutorial on how to embed WinFoms controls inside of WPF application (you can read all about it here). Today, we are going to flip that on its head - we are going to take a look at how to embed WPF controls inside of a WinForms application.

Read More Icon Read More

WPF Tutorial - Using WinForms In WPF


Posted in:

So we all know that WPF is awesome, but it is still a very young framework. And so, sometimes, it doesn't have everything that we might want or desire. For instance, there are a number of controls in WinForms that don't exist in WPF - and they come in handy once in a while. What we are going to look at today is how to use WinForms controls inside of WPF - a very easy and almost painless process, in my opinion.

Read More Icon Read More

WPF Tutorial - How To Use Custom Cursors


Posted in:

So a while back, I did a tutorial on how to do custom cursors in WinForms. In that post I said that at some point in the future, I would write a post on how to do custom cursors in WPF - and here we are! A lot of the code used today is based off of the code from that previous tutorial, so if you haven't read it, I would go do so before you continue.

Read More Icon Read More

Sponsors