Welcome to MSDN Blogs Sign in | Join | Help

Creating a simple master details list

This article describes how to create a master details list using Microsoft Expression Interactive Designer (and guess what: no code needed!). We are going to use databinding to achieve this.

The data-source

We will use a simple xml, containing the list of products from the Expression family, and a short description for each of them. Download the attached "products.xml" and save it on your local machine.

Start Microsoft Expression Interactive Designer. We will use the empty project created by default

Add products.xml as an XML Data source. For that, in the "Data" palette, click on the "Add XML Data Source" and Browse to the "products.xml". Press Ok. Now the Data Palette will show the new data source (its default name is "ProductsDS").

The master list

Expand the "ProductsDS" data source and "Product[n]" node on the scene. Choose ListBox from the context menu. Press "Ok" at the first dialog; in the second one, uncheck "Description" (we want to show only the name in the list) and press Ok. At this point, you should have a list displaying the names of the products.

The details

We want to display the description of the selected item in a separate TextBox.

Create a TextBlock control from the Library Palette

In the "Properties" palette, click on the "Data Context" property and select "Databind". Click on the "Element Property" button, select the "ListBox" as the scene element (left side) and "Selected Item" as the property (right side). Press "Finish". This way we set the Data Context to the Selected Item of the Listbox.

In the "Properties" palette, click on the "Text" property and select "Databind". Click on the "Explicit Data Context" button and expand the tree and select "Description". Press Finish. This way we specify what exactly we want to display as the Text.

Run the project

The only thing left: run the project (In the main menu, Project click on "Run Project"). The application will be compiled and executed. The Description textbox shows the Description of the selected item.

Why is the textbox empty in Expression Interactive Designer ?

That's because, by default, there is no item selected in the list. To do that, select the listbox and set the SelectedIndex property to 0 (by default it is -1).

Published Wednesday, February 15, 2006 10:37 AM by adrianvinca
Attachment(s): products.xml

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Creating a simple master details list

Wednesday, February 15, 2006 10:04 PM by mariogu
great post! nice to see you blogging
-Mario

# re: Creating a simple master details list

Monday, May 29, 2006 6:16 AM by Rohit
Good example for beginning with WPF data-binding. Could u show some more examples to illustrate WPF's power.

# re: Creating a simple master details list

Tuesday, May 30, 2006 4:31 PM by adrianvinca
Hi,

I am really happy that my sample was useful to you. I've been very busy the last few months working on the new features of Expression Interactive Designer, and that's why I didn't get the chance to write newer samples and tutorials. But definitely I want to add more. And feedback like yours is very encouraging!

Thanks,
- Adrian

# No Intellisense for trigger names in template editing

Friday, November 24, 2006 8:27 PM by yuri.usenko

1) I like Expression! It's a joy to use it!!!

2) Heavy Photoshop/ Illustrator and amateur .NET experience appears not enough to start free with templates, databinding, styling. Believe that only few designers will not get into a mess using timelines and frames!

3) Is there a way to make keyframes, triggers, events handling more visually clear? A graph of closest app states plus pop-up (separate from main designer window) views for each node(app state) could help  

4) Some visualisation for databinding - at least as for data fields in Access?  

# re: Creating a simple master details list

Wednesday, November 29, 2006 5:39 AM by adrianvinca

Hi Yuri,

I am really glad that you like Expression!

Indeed, in some cases, in order to access the more advanced features, you may need some knowledge about the platform (WPF). By using the same project format as Visual Studio, Expression Interactive Designer allows developers and designers to work together on the same project. This means that, many times, the developers (who will have deeper knowledge of the platform) will provide the infrastructure and will implement the functionality, and the designers will be able to just open the project and edit the visuals.

Also, we keep improving Expression, and making it easier to use is one of our priorities.

Regarding the data binding visualization, you could try Peter Blois' tool – “Snoop”. It allows you to investigate properties, bindings at runtime and it is really useful for debugging. You may find more details here: http://www.blois.us/Snoop/

Many thanks for your suggestions!

- Adrian

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker