default.aspx
Silverlight .NET Controls and CMS
Home
controls.aspx
Silverlight Controls
Controls
ItemViewer

Silverlight ItemViewer

This Silverlight only ItemViewer allows you to group similar items together in an area that will automatically wrap when resized and is easy to implement on your Silverlight driven website and is also customizable to provide a visual feel suitable for any site design.

How to Use the ItemViewer Control

To use the ItemViewer on your Silverlight page:

<UserControl x:Class="ItemViewer.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:liquid="clr-namespace:Liquid;assembly=Liquid"
    Width="400" Height="300">
     <liquid:ItemViewer x:Name="myList" Width="400" Height="300" DoubleClick="Items_DoubleClick">
          <liquid:ItemViewer.Items>
               <liquid:FileItem Text="My File.pdf" OtherText="300KB" Icon="images/large/pdf.png" />
               <liquid:FileItem Text="My File 2.doc" OtherText="360KB" Icon="images/large/doc.png" />
               <liquid:FileItem Text="My File 3.xls" OtherText="100KB" Icon="images/large/xls.png" />
               <liquid:FileItem Text="My File 4.xaml" OtherText="40KB" Icon="images/large/xaml.png" />
               <liquid:FileItem Text="My File 5.jpg" OtherText="167KB" Icon="images/large/jpg.png" />
               <liquid:FileItem Text="My File 6.mp3" OtherText="96KB" Icon="images/large/mp3.png" />
          </liquid:ItemViewer.Items>
     </liquid:ItemViewer>
</UserControl>

 

The ItemViewer can render controls that derive from the base ItemViewerItem class such as the included FileItem control which, in conjunction with the TreeView control, allows you to build complex file explorer components with relatively small amounts of code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
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 Liquid;

namespace ItemViewer
{
     public partial class Page : UserControl
     {
          public Page()
          {
               InitializeComponent();
          }

          private void Items_DoubleClick(object sender, EventArgs e)
          {
               FileItem selected = myList.Selected;

               // Process your double-click action here
          }
     }
}

 

Example Silverlight ItemViewer Control:

Silverlight ItemViewer Control

Your Comments and Questions Answered

 You are not logged in. You need to login to post new messages, if you do not have a login you can register for free!

dan said:

Hi fiannolo,

Have you tried the Explorer Demo which uses the ItemViewer control? Alternatively, could you email the project and we can take a look at it for you?

11/06/2008 02:48
 
fiannolo said:

Hi, great post.
I try to run it with the final version of silverlight 2.0 and does not work. Can you help me to run it?

11/05/2008 10:45
 
dan said:

Hi,

Thanks for the post, I will check this error out more and let you know what I find out. Thanks!

10/30/2008 05:08
 
mrLIS said:

Hello .. If ItemViewer arrange for TabControl when filling ItemViewer error:
Object reference not set to an instance of an object.

foreach (var BD in BORT_DOCS_FILES)
                         (
                                FileItem ivi = new FileItem ();
                                ivi.Text = BD.FILE_NAME.ToString ();
                                ivi.OtherText = BD.DOC_NAME.ToString ();
                                ivi.Icon = "img / large / jpg.png";
                                ivi.LiquidTag = 0;
                                ListIVI.Add (ivi);
                                / / ivDocs.Items.Add (ivi);
                                i;
                         )
                        
                                ivDocs.Add ((List <FileItem>) ListIVI);

10/28/2008 06:26
 
This page is 25.73KB and was generated by the SilverPages CMS in 0.093 seconds. Total impressions: 2857.