Inheritance: System.Windows.Controls.Button
        /// <summary>
        /// Builds the visual tree for the <see cref="FloatingWindowHost" /> control
        /// when a new template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            UnsubscribeFromEvents();
            UnsubscribeFromTemplatePartEvents();

            base.OnApplyTemplate();

            root             = GetTemplatePart <Grid>(PART_Root);
            contentRoot      = GetTemplatePart <FrameworkElement>(PART_ContentRoot);
            hostCanvas       = GetTemplatePart <Canvas>(PART_HostCanvas);
            modalCanvas      = GetTemplatePart <Canvas>(PART_ModalCanvas);
            iconBarContainer = GetTemplatePart <FrameworkElement>(PART_IconBarContainer);
            overlay          = GetTemplatePart <Grid>(PART_Overlay);
            iconBar          = GetTemplatePart <IconBar>(PART_IconBar);
            bottomBar        = GetTemplatePart <FrameworkElement>(PART_BottomBar);
            bootstrapButton  = GetTemplatePart <BootstrapButton>(PART_BootstrapButton);
            barContent       = GetTemplatePart <ContentControl>(PART_BarContent);

            iconBar.FloatingWindowHost = this;

            SetStyles();
            SubscribeToTemplatePartEvents();
            SubscribeToEvents();

            templateIsApplied = true;
        }
        /// <summary>
        /// IsOpenProperty PropertyChangedCallback call back static function.
        /// </summary>
        /// <param name="d">BootstrapButton object whose IsOpenProperty property is changed.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param>
        private static void IsOpenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            BootstrapButton button = (BootstrapButton)d;

            VisualStateManager.GoToState(
                button,
                (bool)e.NewValue ? VSMSTATE_StateClose : VSMSTATE_StateOpen,
                true);
        }