Browse Source

TreeView now displays stuff.

pull/4/head
Steven Kirk 12 years ago
parent
commit
c4773de9e4
  1. 2
      Perspex/Controls/TreeDataTemplate.cs
  2. 144
      TestApplication/Program.cs

2
Perspex/Controls/TreeDataTemplate.cs

@ -41,7 +41,7 @@ namespace Perspex.Controls
public class TreeDataTemplate<T> : TreeDataTemplate
{
public TreeDataTemplate(
Func<object, Control> build,
Func<T, Control> build,
Func<T, IEnumerable> itemsSelector)
: base(typeof(T), o => build((T)o), o => itemsSelector((T)o))
{

144
TestApplication/Program.cs

@ -87,7 +87,7 @@ namespace TestApplication
DataTemplates = new DataTemplates
{
new TreeDataTemplate<Node>(
x => new TextBlock { Text = x.ToString() },
x => new TextBlock { Text = x.Name },
x => x.Children),
},
};
@ -98,77 +98,77 @@ namespace TestApplication
{
Items = new[]
{
//new TabItem
//{
// Header = "Buttons",
// Content = new StackPanel
// {
// Orientation = Orientation.Vertical,
// HorizontalAlignment = HorizontalAlignment.Center,
// VerticalAlignment = VerticalAlignment.Center,
// Gap = 8,
// MinWidth = 120,
// Children = new Controls
// {
// new Button
// {
// Content = "Button",
// },
// new Button
// {
// Content = "Button",
// Background = new SolidColorBrush(0xcc119eda),
// },
// new CheckBox
// {
// Content = "Checkbox",
// },
// }
// },
//},
//new TabItem
//{
// Header = "Text",
// Content = new StackPanel
// {
// Orientation = Orientation.Vertical,
// HorizontalAlignment = HorizontalAlignment.Center,
// VerticalAlignment = VerticalAlignment.Center,
// Gap = 8,
// Width = 120,
// Children = new Controls
// {
// new TextBlock
// {
// Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt.",
// },
// new TextBox
// {
// Text = "Text Box",
// },
// }
// },
//},
//new TabItem
//{
// Header = "Images",
// Content = new StackPanel
// {
// Orientation = Orientation.Vertical,
// HorizontalAlignment = HorizontalAlignment.Center,
// VerticalAlignment = VerticalAlignment.Center,
// Gap = 8,
// Width = 120,
// Children = new Controls
// {
// new Image
// {
// Source = new Bitmap("github_icon.png"),
// Width = 200,
// },
// }
// },
//},
new TabItem
{
Header = "Buttons",
Content = new StackPanel
{
Orientation = Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Gap = 8,
MinWidth = 120,
Children = new Controls
{
new Button
{
Content = "Button",
},
new Button
{
Content = "Button",
Background = new SolidColorBrush(0xcc119eda),
},
new CheckBox
{
Content = "Checkbox",
},
}
},
},
new TabItem
{
Header = "Text",
Content = new StackPanel
{
Orientation = Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Gap = 8,
Width = 120,
Children = new Controls
{
new TextBlock
{
Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt.",
},
new TextBox
{
Text = "Text Box",
},
}
},
},
new TabItem
{
Header = "Images",
Content = new StackPanel
{
Orientation = Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Gap = 8,
Width = 120,
Children = new Controls
{
new Image
{
Source = new Bitmap("github_icon.png"),
Width = 200,
},
}
},
},
new TabItem
{
Header = "Lists",

Loading…
Cancel
Save