// -----------------------------------------------------------------------
//
// Copyright 2014 MIT Licence. See licence.md for more information.
//
// -----------------------------------------------------------------------
namespace Perspex.Controls
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
///
/// Base class for controls that can contain multiple children.
///
public class Panel : Control, ILogical, IVisual
{
private Controls children;
private LogicalChildren logicalChildren;
public Controls Children
{
get
{
if (this.children == null)
{
this.children = new Controls();
this.logicalChildren = new LogicalChildren(this, this.children);
}
return this.children;
}
set
{
this.children = value;
if (this.logicalChildren != null)
{
this.logicalChildren.Change(this.children);
}
else
{
this.logicalChildren = new LogicalChildren(this, this.children);
}
}
}
IEnumerable ILogical.LogicalChildren
{
get { return this.children ?? Enumerable.Empty(); }
}
IEnumerable IVisual.VisualChildren
{
get { return this.children ?? Enumerable.Empty(); }
}
}
}