Called after the template is completely generated and attached to the visual tree.
public override void OnApplyTemplate()
Overrides Public Sub OnApplyTemplate()
This method is invoked whenever application code or internal processes call the System.Windows.FrameworkElement.ApplyTemplate method. To learn more, refer to the System.Windows.FrameworkElement.OnApplyTemplate topic in MSDN.