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.
38 lines
1.3 KiB
38 lines
1.3 KiB
// -----------------------------------------------------------------------
|
|
// <copyright file="ItemsControl.cs" company="Steven Kirk">
|
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
|
// </copyright>
|
|
// -----------------------------------------------------------------------
|
|
|
|
namespace Perspex.Controls
|
|
{
|
|
using System.Collections;
|
|
|
|
public class ItemsControl : TemplatedControl
|
|
{
|
|
private static readonly ItemsPanelTemplate defaultPanel =
|
|
new ItemsPanelTemplate(() => new StackPanel { Orientation = Orientation.Vertical });
|
|
|
|
public static readonly PerspexProperty<IEnumerable> ItemsProperty =
|
|
PerspexProperty.Register<ItemsControl, IEnumerable>("Items");
|
|
|
|
public static readonly PerspexProperty<ItemsPanelTemplate> ItemsPanelProperty =
|
|
PerspexProperty.Register<ItemsControl, ItemsPanelTemplate>("ItemsPanel", defaultValue: defaultPanel);
|
|
|
|
public ItemsControl()
|
|
{
|
|
}
|
|
|
|
public IEnumerable Items
|
|
{
|
|
get { return this.GetValue(ItemsProperty); }
|
|
set { this.SetValue(ItemsProperty, value); }
|
|
}
|
|
|
|
public ItemsPanelTemplate ItemsPanel
|
|
{
|
|
get { return this.GetValue(ItemsPanelProperty); }
|
|
set { this.SetValue(ItemsPanelProperty, value); }
|
|
}
|
|
}
|
|
}
|
|
|