// ----------------------------------------------------------------------- // // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Controls { using System; using System.Collections.Generic; using System.Linq; using Perspex.Controls; using Perspex.Controls.Primitives; using Perspex.LogicalTree; using Perspex.Styling; using Perspex.VisualTree; public static class ControlExtensions { public static T FindControl(this Control control, string id) where T : Control { return control.GetLogicalDescendents() .OfType() .FirstOrDefault(x => x.Name == id); } } }