Languages - XAML

WPF Tutorial - Binding Validation Rules


Posted in:

Bindings are a major part of WPF, and a big part of what makes it quick to create user interfaces in. They can be a little wordy and hard to debug sometimes, but overall they are extremely useful. Hopefully, after today's tutorial, you will find them even more useful - because today we are going to talk about building validation rules right into your bindings. Yup, you heard right - bindings in WPF have built in support for validation, and a number of the common controls have built in ways for displaying validation errors.

Read More Icon Read More

WPF Tutorial - Custom Control Templates


Posted in:

Almost every control in WPF uses a control template to define how it displays itself and its contents. In fact, you can override the control template on every built-in control to make it appear and act exactly like you want. Rather than overriding an existing template, however, this tutorial is going to demonstrate how to build a custom content control and use a control template to define how it looks.

Read More Icon Read More

Using the WPF Toolkit DataGrid


Posted in:

WPF comes with a large number of built in controls, but from the beginning it has lacked something that many application developers find extremely important - a DataGrid. You can use the ListView to create something approximating a DataGrid (I've talked about it in a couple different tutorials), but it is a lot of work and not particularly straightforward. Thankfully, Microsoft realizes how important a full-featured DataGrid is - and how you probably don't want to wait for the next version of WPF to be able to use one. This is where the WPF Toolkit comes in. The WPF Toolkit is "a collection of WPF features and components that are being made available outside of the normal .NET Framework ship cycle" which to me translates as "handy new controls I don't have to wait for".

Read More Icon Read More

WPF Snippet - Determining If Text Is Ellipsed


Posted in:

So here's the problem - say you have a WPF TextBlock with some text (with automatic ellipsing turned on) and you want to know if the text is actually ellipsed at the moment. Sounds simple, right? Unfortunately, there are no properties or methods that you can call to check - well, no public properties or methods, that is. So this makes a simple question into a much harder answer.

Read More Icon Read More

WPF - Print Queues And Capabilities


Posted in:

We have taken a look at printing in WPF twice before here at SOTC - first with a simple tutorial on just getting something printed, and then a more complex one on pagination. Today we are not going to focus much on the printing side of things, but more on the printer side. For example, how do you get a list of the printers available on the system? Or their capabilities? If you need the answers to those questions, then this is the tutorial for you.

Read More Icon Read More

WPF Tutorial - Implementing IScrollInfo


Posted in:

The ScrollViewer in WPF is pretty handy (and quite flexible) - especially when compared to what you had to work with in WinForms (ScrollableControl). 98% of the time, I can make the ScrollViewer do what I need it to for the given situation. Those other 2 percent, though, can get kind of hairy. Fortunately, WPF provides the IScrollInfo interface - which is what we will be talking about today.

Read More Icon Read More

WPF Tutorial - Fun With Markup Extensions


Posted in:

Markup extensions! A very important aspect of XAML - but while you are using them all the time, you probably pay very little attention to the fact that they are markup extensions. Every time you are using those curly braces in XAML, you are dealing with a markup extension. Probably the most common one is StaticResource, but Binding is probably up there too.

Read More Icon Read More

Printing in WPF


Posted in:

Printing. Ugh. Every programmer I know hates writing code to do printing. Stuff never seems to appear quite how it should - the transition from the screen to the page can often be a very messy one. Printing with the Win32 API is ugly - something more akin to black magic and dark incantations than actual computer code. The .NET framework made it a little bit better in WinForms, but it was still just a very thin wrapper around the Win32 api - and it was still in the world of GDI. But now we are in the land of WPF! The land of lollipops and hope and magical wonders! So everything should be awesome, right?

Read More Icon Read More

Silverlight and the Netflix API


Posted in:

Even though the Netflix API was released back in October, I just recently discovered it. I enjoy seeing new APIs and was definitely interested in using this one since I'm also a Netflix subscriber. This tutorial will demonstrate how to build a simple Silverlight application on top of the Netflix API.

Read More Icon Read More

Silverlight 2 & PHP Tutorial - Transmitting data using JSON


Posted in:

So I'm sitting here, trying to come up with something interesting to write about for a Silverlight tutorial, when an idea struck - go look at our old Flex tutorials! The Fattest spent a bunch of time coming up with great examples of how to accomplish various tasks in Flex - and supposedly anything that Flex can do, Silverlight can do too. I went and looked, and I didn't have to look very far. In the very first tutorial The Fattest wrote on Flex here at SOTC ( Flex & PHP Tutorial - Transmitting data using JSON), I ran into something I didn't know how to do in Silverlight - use JSON.

Read More Icon Read More