Sign in
Data See, Data Do
Mike Hillberg's Blog on Wpf and Silverlight
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Options
Email Blog Author
RSS for posts
Atom
RSS for comments
OK
Search
Tags
Anatomy
Data binding
Tips and Tricks
Xaml
Archive
Archives
November 2009
(1)
October 2009
(1)
March 2009
(4)
January 2009
(1)
September 2008
(1)
June 2008
(1)
May 2008
(4)
April 2008
(1)
July 2007
(3)
May 2007
(6)
February 2007
(1)
November 2006
(1)
October 2006
(2)
September 2006
(9)
MSDN Blogs
>
Data See, Data Do
Posts
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
Data See, Data Do
A Custom Storyboard Component in Xaml
Posted
over 4 years ago
by
Mike Hillberg [Microsoft]
0
Comments
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...
Data See, Data Do
TreeView and HierarchicalDataTemplate, Step-by-Step
Posted
over 4 years ago
by
Mike Hillberg [Microsoft]
5
Comments
I’ve never found TreeView to be terribly confusing by itself. But usually I want to data bind a TreeView to a collection with some hierarchy, which leads me to HierarchicalDataTemplate, which didn’t always just write itself for me. If you look at it in...
Data See, Data Do
Why is it called a "DependencyProperty"?
Posted
over 4 years ago
by
Mike Hillberg [Microsoft]
7
Comments
When we create new classes and members we spend a lot of time and effort to make them as usable, understandable, and discoverable as possible. We follow the .Net Design Guidelines in general, and in particular we constantly look at how this new class...
Data See, Data Do
Implementing SelectedValue with the Silverlight ComboBox
Posted
over 4 years ago
by
Mike Hillberg [Microsoft]
10
Comments
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...
Data See, Data Do
An ICommand with IsEnabled
Posted
over 4 years ago
by
Mike Hillberg [Microsoft]
5
Comments
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...
Data See, Data Do
ICommand is like a chocolate cake
Posted
over 4 years ago
by
Mike Hillberg [Microsoft]
10
Comments
(This has been updated with some information about the origin of a routed command’s route, and of focus scopes.) ICommand in WPF is a pretty simple thing at its core. But it gets more interesting and complicated as you build up functionality on...
Data See, Data Do
A master/detail view with navigation
Posted
over 4 years ago
by
Mike Hillberg [Microsoft]
3
Comments
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...
Data See, Data Do
A Comparable DataTrigger
Posted
over 5 years ago
by
Mike Hillberg [Microsoft]
7
Comments
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...
Data See, Data Do
Compact CheckBox Sample
Posted
over 5 years ago
by
Mike Hillberg [Microsoft]
2
Comments
I was creating a view of an object that had a bunch of boolean properties, but I wanted to keep the visual representation small. So I created a look for a compact CheckBox that I liked enough to post. As an example scenario, say I’m visualizing a the...
Data See, Data Do
Trying out Binding.StringFormat
Posted
over 5 years ago
by
Mike Hillberg [Microsoft]
6
Comments
StringFormat is a new property in .Net 3.5 SP1, which is currently in Beta. See Scott’s blog for more info on the beta. When you bind data into a property on an element, it’s automatically type converted for you. For example, this markup: ...
Data See, Data Do
Of logical and visual trees in WPF
Posted
over 5 years ago
by
Mike Hillberg [Microsoft]
9
Comments
This post is about the “logical tree” in WPF, and how it differs from the visual tree. For the most part you don’t need to understand this. But if you want to understand some of the nit-like details of property inheritance, {DynamicResource} references...
Data See, Data Do
Model-see, Model-do, and the Poo is Optional
Posted
over 5 years ago
by
Mike Hillberg [Microsoft]
4
Comments
Like a lot of people, I’ve developed software professionally for a lot of different environments: PC systems and embedded systems; high- and low-level languages; kernel mode, user mode, real mode, and protected mode; system services; domain controllers;...
Data See, Data Do
Binding to anonymous types in an Xbap or Silverlight application
Posted
over 5 years ago
by
Mike Hillberg [Microsoft]
5
Comments
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...
Data See, Data Do
Simple way to create a gradient brush in Xaml
Posted
over 5 years ago
by
Mike Hillberg [Microsoft]
1
Comments
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...
Data See, Data Do
A Context-Sensitive Help Provider in Wpf
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
20
Comments
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...
Data See, Data Do
A look at stretchy elements
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
1
Comments
There are several elements in Wpf that have a "Stretch" property. The basic idea of these properties is to allow you to specify how an element adapts itself to a layout container, such as a Grid. For example, if you have a 100x200 pixel image, and it...
Data See, Data Do
Building read-only objects in Xaml
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
1
Comments
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? ...
Data See, Data Do
Two ProgressBar Tricks
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
4
Comments
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...
Data See, Data Do
Namespaces in Xaml
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
1
Comments
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 ...
Data See, Data Do
Expandos in xaml
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
1
Comments
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...
Data See, Data Do
Where does a Binding find its data?
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
5
Comments
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...
Data See, Data Do
How to target a template setter at non-element content
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
3
Comments
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: <...
Data See, Data Do
Tip: Using XamlWriter and XamlReader to clone an object
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
4
Comments
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...
Data See, Data Do
Parameterized templates; and how to create reusable, custom-looking buttons without code
Posted
over 6 years ago
by
Mike Hillberg [Microsoft]
1
Comments
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...
Data See, Data Do
How to control the mouse cursor
Posted
over 7 years ago
by
Mike Hillberg [Microsoft]
1
Comments
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. ...
Page 1 of 2 (36 items)
1
2