List box with text and non-text content in the list box items.
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:ListBoxEvent"
x:Class="ListBoxEvent.Pane1">
<StackPanel>
<DockPanel Margin="10, 10, 3, 3" >
<ListBox SelectionMode="Multiple">
<DockPanel>
<Image Source="data\cat.png"/>
<TextBlock>CAT</TextBlock>
</DockPanel>
<DockPanel>
<Image Source="data\dog.png"/>
<TextBlock>DOG</TextBlock>
</DockPanel>
<DockPanel>
<Image Source="data\fish.png"/>
<TextBlock>FISH</TextBlock>
</DockPanel>
</ListBox>
</DockPanel>
</StackPanel>
</Canvas>
//File:Window.xaml.cs
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media;
using System.Collections.ObjectModel;
namespace ListBoxEvent
{
public partial class Pane1 : Canvas
{
public Pane1() : base()
{
InitializeComponent();
}
}
}
Related examples in the same category