// -----------------------------------------------------------------------
//
// Copyright 2015 MIT Licence. See licence.md for more information.
//
// -----------------------------------------------------------------------
namespace Perspex.Controls.Templates
{
using System;
///
/// Builds a control for a piece of data of specified type.
///
/// The type of the template's data.
public class DataTemplate : DataTemplate
{
///
/// Initializes a new instance of the class.
///
///
/// A function which when passed an object of returns a control.
///
public DataTemplate(Func build)
: base(typeof(T), CastBuild(build))
{
}
///
/// Initializes a new instance of the class.
///
///
/// A function which determines whether the data template matches the specified data.
///
///
/// A function which when passed an object of returns a control.
///
public DataTemplate(Func match, Func build)
: base(CastMatch(match), CastBuild(build))
{
}
///
/// Casts a stongly typed match function to a weakly typed one.
///
/// The strongly typed function.
/// The weakly typed function.
private static Func