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 class TreeDataTemplate<T> : TreeDataTemplate
{ {
public TreeDataTemplate( public TreeDataTemplate(
Func<object, Control> build, Func<T, Control> build,
Func<T, IEnumerable> itemsSelector) Func<T, IEnumerable> itemsSelector)
: base(typeof(T), o => build((T)o), o => itemsSelector((T)o)) : base(typeof(T), o => build((T)o), o => itemsSelector((T)o))
{ {

144
TestApplication/Program.cs

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

Loading…
Cancel
Save