Пример #1
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (AllowShadows)
            {
                FrameworkElement tb = (FrameworkElement)this.GetTemplateChild("TitleBackground");
                FrameworkElement cr = (FrameworkElement)this.GetTemplateChild("ContentRoot");
                CompositionFactory.SetThemeShadow(cr, 40, tb);
            }

            if (this.GetTemplateChild("BtnClose") is Button close)
            {
                close.Click -= Close_Click;
                close.Click += Close_Click;
            }

            if (this.GetTemplateChild("TitleBackground") is FrameworkElement f && IsWindowRoot)
            {
                TitleBarHelper.SetTitleBar(f);
                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            }

            OnTitleContentChanged();
        }
Пример #2
0
 public void SetWindowTitleBar()
 {
     this.ApplyTemplate();
     if (this.GetTemplateChild("TitleBackground") is FrameworkElement e)
     {
         e.Measure(new Windows.Foundation.Size(32, 32));
         TitleBarHelper.SetTitleBar(e);
     }
 }