Catel.Windows.DataWindow.OnApplyTemplate C# (CSharp) Method

OnApplyTemplate() public method

Builds the visual tree for the T:System.Windows.Controls.ChildWindow control when a new template is applied.
public OnApplyTemplate ( ) : void
return void
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // Solves issue where ChildWindow does not center when browser is not active
            var contentRoot = GetTemplateChild("ContentRoot") as FrameworkElement;
            if (contentRoot != null)
            {
                bool centerChildWindow = (HorizontalAlignment == HorizontalAlignment.Center) && (VerticalAlignment == VerticalAlignment.Center);
                if (centerChildWindow)
                {
                    Dispatcher.BeginInvoke(CenterInScreen);
                }
            }
            else
            {
                Log.Debug("Cannot center childwindow because 'ContentRoot' cannot be found");
            }
        }