/// <summary>
 /// Provides derived classes an opportunity to handle changes to the Template property.
 /// </summary>
 protected virtual void OnTemplateChanged(ControlTemplate oldTemplate, ControlTemplate newTemplate)
 {
     _mask = (FrameworkElement)newTemplate.LoadContent();
     _canvas.Children.Clear();
     _canvas.Children.Add(_mask);
     SetBindings();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DataTemplateElement"/> class.
        /// </summary>
        /// <param name="controlTemplate">The data template.</param>
        /// <param name="boundType">Type of the bound.</param>
        /// <param name="baseName">Name of the base.</param>
        internal ControlTemplateElement(ControlTemplate controlTemplate, BoundType boundType, string baseName)
            : base(controlTemplate.LoadContent(), boundType)
        {
            _controlTemplate = controlTemplate;

            if(_controlTemplate.TargetType != null)
                BaseName = baseName + " [ControlTemplate " + _controlTemplate.TargetType.Name + "] ";

            else BaseName = baseName + " [ControlTemplate] ";
        }