Mega Code Archive
Create a style that will produce a horizontal ListBox
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
//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;
namespace ListBox_Index
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void PrintText(object sender, SelectionChangedEventArgs args){
ListBoxItem lbi = ((sender as ListBox).SelectedItem as ListBoxItem);
if( lbi == null ) return;
label1.Content = "You chose " + lbi.Content.ToString() + ".";
}
}
}