08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

202<br />

CHAPTER 8 ■ .<strong>NET</strong> 3.0: WINDOWS PRESENTATION FOUNDATION<br />

Figure 8-24. Binding the ListBox to data with a template<br />

15. Because the definition of the ListBox <strong>and</strong> its binding is in XAML, you can easily<br />

edit it to customize the template. Open the XAML view of this window, <strong>and</strong> you<br />

can add a new node to separate the list items from each other.<br />

For example, here is a data template that was designed to just render the Address1<br />

<strong>and</strong> ZIP code fields:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

16. You see that it uses two TextBlock controls: one is bound to the AddressLine1 field,<br />

<strong>and</strong> the other to the PostalCode field. You can add a new XAML node underneath,<br />

for example, for an empty label that will create spacing between the elements.<br />

Here’s an example:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!