// ----------------------------------------------------------------------- // // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Themes.Default { using System.Linq; using Perspex.Controls; using Perspex.Styling; public class ItemsControlStyle : Styles { public ItemsControlStyle() { this.AddRange(new[] { new Style(x => x.OfType()) { Setters = new[] { new Setter(Button.TemplateProperty, ControlTemplate.Create(this.Template)), }, }, }); } private Control Template(ItemsControl control) { return new ItemsPresenter { [~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], [~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], }; } } }