Click here to Skip to main content
15,895,777 members
Articles / Desktop Programming / XAML

Numbered And Bulleted Lists for Silverlight

Rate me:
Please Sign up or sign in to vote.
3.89/5 (5 votes)
8 Jun 2008CPOL8 min read 56.6K   482   27  
Counterpart of HTML's ol and ul tags for Silverlight
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace Test
{
    public partial class Page : UserControl
    {
        // -------------------------------
        // Define Book class
        public class Book
        {
            public Book()
            {
            }

            public Book(string isbn, string title, DateTime publishdate, double price)
            {
                this.ISBN = isbn;
                this.Title = title;
                this.PublishDate = publishdate;
                this.Price = price;
            }

            public string ISBN { get; set; }
            public string Title { get; set; }
            public DateTime PublishDate { get; set; }
            public double Price { get; set; }
        }

        // -------------------------------
        //Create a collection to store data items
        public ObservableCollection<Book> _AllBooks;

        // -------------------------------

        public Page()
        {
            InitializeComponent();

            // Create collection with books
            _AllBooks = new ObservableCollection<Book>();
            _AllBooks.Add(new Book("3390092284", "All About Dogs", new DateTime(2004, 3, 4), 12.99));
            _AllBooks.Add(new Book("4458907683", "Training Your Dog", new DateTime(2000, 2, 8), 44.25));
            _AllBooks.Add(new Book("1258907683", "Training Your Cat", new DateTime(2000, 2, 8), 44.25));
            _AllBooks.Add(new Book("8456586489", "Kids and Dogs", new DateTime(2007, 5, 18), 10.50));

            // Show the _AllBooks list in the MyBooks ListBox
            MyBooks.DataContext = _AllBooks;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Australia Australia
Twitter: @MattPerdeck
LinkedIn: au.linkedin.com/in/mattperdeck
Current project: JSNLog JavaScript Logging Package

Matt has over 9 years .NET and SQL Server development experience. Before getting into .Net, he worked on a number of systems, ranging from the largest ATM network in The Netherlands to embedded software in advanced Wide Area Networks and the largest ticketing web site in Australia. He has lived and worked in Australia, The Netherlands, Slovakia and Thailand.

He is the author of the book ASP.NET Performance Secrets (www.amazon.com/ASP-NET-Site-Performance-Secrets-Perdeck/dp/1849690685) in which he shows in clear and practical terms how to quickly find the biggest bottlenecks holding back the performance of your web site, and how to then remove those bottlenecks. The book deals with all environments affecting a web site - the web server, the database server and the browser.

Matt currently lives in Sydney, Australia. He recently worked at Readify and the global professional services company PwC. He now works at SP Health, a global provider of weight loss web sites such at CSIRO's TotalWellBeingDiet.com and BiggestLoserClub.com.

Comments and Discussions