Browse by Tags
All Tags »
Tips and Tricks (RSS)
In WPF & Silverlight, a Storyboard is a collection of animations running in parallel. Not everyone likes the name “Storyboard” though. The idea behind the name was that that list of timelines running in parallel are like a list of plot lines in the
Read More...
Here’s the scenario … You have a Customers collection and an Orders collection. In the Orders collection, an Order has a CustomerID property; this is the key to an item in the Customers collection. Your goal is a ComboBox that updates the CustomerID property
Read More...
Attachment(s): SelectedValue.zip
ICommand is a simple interface with three members – Execute, CanExecute, and CanExecuteChanged (more on those here ). You can write your own implementations of that interface, one for each command, but that gets a bit heavyweight. So there are several
Read More...
I don’t remember what got me thinking about it, but somewhere along the line I wanted a master/detail view with a navigation bar. E.g., when you change selection in the master view, you can navigate back to the previous selection. Here’s an example (here
Read More...
Property triggers today only check for equality. We’d like to add support for other comparison operators, but that hasn’t happened yet. But I needed them for a project, and wrote a workaround for it. It’s a bit hacky in a couple of places, but if you
Read More...
It's easy to use Linq queries to create objects, and to use {Binding}s to bind properties of those objects into your view. If you're doing this for an application that will run as an Xbap ("WPF Browser Application") or as a Silverlight app, just note
Read More...
Rob , Nikhil & I were talking today about the early days of Xaml when you could create linear gradient brushes as an attribute value. E.g. (borrowing from Rob’s post on this subject) instead of creating a LinearGradientBrush for the fill of a rectangle
Read More...
Here's an example of a way to add context-sensitive help to your application. The main idea is to simply use the built-in ApplicationCommands.Help command. This command is already tied to the F1 key, and so executes when you hit F1, and tells your command
Read More...
Attachment(s): ContextSensitiveHelp.zip
We often use Xaml to instantiate and initialize objects. For example, given “<Foo Bar=’1’/>”, a Xaml loader creates a Foo object, and sets the Bar property to 1. That works when the Bar property is settable, but what can you do if it isn’t? An example
Read More...
Here’s a couple of handy ProgressBar tricks … The first trick is to use a negative Minimum value, so that as soon as a ProgressBar starts, you give the user the visual feel that the progress has already begun. This is especially useful if, in your scenario,
Read More...
Attachment(s): Loading.jpg
This post has a couple of suggestions on ways to accomplish expandos in Xaml. F irst some background … On an HTML page you can define your own new “expando” properties on the fly, such as in this example: < HTML > < BODY onload = ' paragraph1.innerText
Read More...
Here’s a technique you can follow to use property triggers in a template on non-element type objects. First, though, some background on what that means … Take this example of a Button with a custom template which is simply a rectangle: < Button >
Read More...
There are multiple ways to clone objects, and multiple definitions of what “clone” should even mean. The main issue is usually about cloning “deep” vs. “shallow”. For example, if you have a Customer object that points to an Address object, and you clone
Read More...
I’ve talked to a few people recently about parameterized templates, and so I wanted to write some of it down. Here’s the scenario … I want to create an application that has a main window with several buttons on it. Clicking one of the buttons navigates
Read More...
Attachment(s): pt1.jpg
How to set the mouse cursor in one easy step: set the Cursor property. For example, this markup: < Button Cursor = " Help " > Help </ Button > … sets the cursor to be the “ Help ” cursor, when the mouse is over the button. Note that since
Read More...