|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SharedSizeTestApp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
// create the list and some items for the ListBox part
Items = new List<ItemType>();
Items.Add(new ItemType(1, "Item 1", "This item 1", "This is some more info about item 1", "extra extra"));
Items.Add(new ItemType(2, "Item 2", "This item 2", "This is some more info about item 2\nAnd even more info on this one", "extra extra"));
Items.Add(new ItemType(3, "Item 3", "This item 3", "This is some more info about item 3", "extra extra"));
InitializeComponent();
}
// List of items
public IList<ItemType> Items { get; private set; }
}
// class to hold binding data for the ListBoxes
public class ItemType
{
public ItemType(int uniqueId, string name, string someInfo, string someMoreInfo, string extraInfo)
{
UniqueId = uniqueId;
Name = name;
SomeInfo = someInfo;
SomeMoreInfo = someMoreInfo;
ExtraInfo = extraInfo;
}
public int UniqueId { get; private set; }
public string Name { get; private set; }
public string SomeInfo { get; private set; }
public string SomeMoreInfo { get; private set; }
public string ExtraInfo { get; private set; }
}
// Simple ValueConverter to convert a bool to Visibility
public class BoolVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return (value != null && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.