Two ProgressBar Tricks

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, it takes a couple of seconds to…

4

Namespaces in Xaml

If you’re really into Xml conformance, and you’ve really wondered how Xaml uses Xml namespaces, read on; I can cover the most relevant details in 1160 words or less …   Namespaces on tags   (I’m using the term “tag” here instead of the more correct term “element”, so that I don’t get confused with…

1

Expandos in xaml

This post has a couple of suggestions on ways to accomplish expandos in Xaml.  First 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 = paragraph1.testing’>     <P ID=’paragraph1′ testing=’1, 2, 3’/>   </BODY> </HTML>…

1

Where does a Binding find its data?

If you’ve look at much WPF Xaml you’ve probably seen bindings like this:   <TextBlock Text=”{Binding Name” />   … which binds the Text property of the TextBlock to the Name property of some data object.   The question that begets is:  where does the data come from?  The rest of this post looks at…

5

How to target a template setter at non-element content

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>   <Button.Template>     <ControlTemplate TargetType=”Button”>       <Rectangle Width=’60’ Height=’40’ Fill=’Red’ x:Name=’MyRectangle’>…

3

Tip: Using XamlWriter and XamlReader to clone an object

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 the Customer object, does the Address object get cloned too (this…

4