Browse Source

Improve tab item aesthetics a bit.

pull/4/head
Steven Kirk 12 years ago
parent
commit
017e6d2155
  1. 19
      Perspex/Themes/Default/TreeViewItemStyle.cs
  2. 2
      TestApplication/Program.cs

19
Perspex/Themes/Default/TreeViewItemStyle.cs

@ -26,7 +26,14 @@ namespace Perspex.Themes.Default
new Setter(Button.TemplateProperty, ControlTemplate.Create<TreeViewItem>(this.Template)), new Setter(Button.TemplateProperty, ControlTemplate.Create<TreeViewItem>(this.Template)),
}, },
}, },
new Style(x => x.OfType<TreeViewItem>().Class(":selected").Template().OfType<ContentPresenter>()) new Style(x => x.OfType<TreeViewItem>().Template().Id("header"))
{
Setters = new[]
{
new Setter(Border.PaddingProperty, new Thickness(2)),
},
},
new Style(x => x.OfType<TreeViewItem>().Class(":selected").Template().Id("header"))
{ {
Setters = new[] Setters = new[]
{ {
@ -71,12 +78,16 @@ namespace Perspex.Themes.Default
Classes = new Classes("expander"), Classes = new Classes("expander"),
[~~ToggleButton.IsCheckedProperty] = control[~TreeViewItem.IsExpandedProperty], [~~ToggleButton.IsCheckedProperty] = control[~TreeViewItem.IsExpandedProperty],
}, },
new ContentPresenter new Border
{ {
Id = "header",
[~ContentPresenter.BackgroundProperty] = control[~TreeViewItem.BackgroundProperty], [~ContentPresenter.BackgroundProperty] = control[~TreeViewItem.BackgroundProperty],
[Grid.ColumnProperty] = 1, [Grid.ColumnProperty] = 1,
[~ContentPresenter.ContentProperty] = control[~TreeViewItem.HeaderProperty], Content = new ContentPresenter
}, {
[~ContentPresenter.ContentProperty] = control[~TreeViewItem.HeaderProperty],
},
}
} }
}, },
new ItemsPresenter new ItemsPresenter

2
TestApplication/Program.cs

@ -193,7 +193,7 @@ namespace TestApplication
} }
}; };
System.Console.WriteLine(Perspex.Diagnostics.Debug.PrintVisualTree(window)); //System.Console.WriteLine(Perspex.Diagnostics.Debug.PrintVisualTree(window));
window.Show(); window.Show();
Dispatcher.Run(); Dispatcher.Run();

Loading…
Cancel
Save