csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.7 KiB
48 lines
1.7 KiB
// -----------------------------------------------------------------------
|
|
// <copyright file="TreeViewStyle.cs" company="Steven Kirk">
|
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
|
// </copyright>
|
|
// -----------------------------------------------------------------------
|
|
|
|
namespace Perspex.Themes.Default
|
|
{
|
|
using System.Linq;
|
|
using Perspex.Controls;
|
|
using Perspex.Media;
|
|
using Perspex.Styling;
|
|
|
|
public class TreeViewStyle : Styles
|
|
{
|
|
public TreeViewStyle()
|
|
{
|
|
this.AddRange(new[]
|
|
{
|
|
new Style(x => x.OfType<TreeView>())
|
|
{
|
|
Setters = new[]
|
|
{
|
|
new Setter(TreeView.TemplateProperty, ControlTemplate.Create<TreeView>(this.Template)),
|
|
new Setter(TreeView.BorderBrushProperty, Brushes.Black),
|
|
new Setter(TreeView.BorderThicknessProperty, 1.0),
|
|
},
|
|
},
|
|
});
|
|
}
|
|
|
|
private Control Template(TreeView control)
|
|
{
|
|
return new Border
|
|
{
|
|
Padding = new Thickness(4),
|
|
[~Border.BackgroundProperty] = control[~TreeView.BackgroundProperty],
|
|
[~Border.BorderBrushProperty] = control[~TreeView.BorderBrushProperty],
|
|
[~Border.BorderThicknessProperty] = control[~TreeView.BorderThicknessProperty],
|
|
Content = new ItemsPresenter
|
|
{
|
|
[~ItemsPresenter.ItemsProperty] = control[~TreeView.ItemsProperty],
|
|
[~ItemsPresenter.ItemsPanelProperty] = control[~TreeView.ItemsPanelProperty],
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|