Example #1
0
        private static void OnCanCloseFlyout(object sender, CanExecuteRoutedEventArgs e)
        {
            FlyoutStacks flyoutstacks = (FlyoutStacks)sender;

            e.CanExecute = flyoutstacks.Items.Count > 0;
            e.Handled    = true;
        }
Example #2
0
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     _flyoutStacks = GetTemplateChild(PART_FLYOUTSTACKS) as FlyoutStacks;
     _dialogStacks = GetTemplateChild(PART_DIALOGSTACKS) as DialogStacks;
     if (_flyoutStacks == null &&
         _dialogStacks == null)
     {
         throw new Exception();
     }
 }
Example #3
0
 public void Close()
 {
     if (this.ParentFlyoutStacks != null && this.ParentFlyoutStacks.Items.Contains(this) && object.ReferenceEquals(this.ParentFlyoutStacks.Items[this.ParentFlyoutStacks.Items.Count - 1], this))
     {
         this.ParentFlyoutStacks.CloseFlyout();
     }
     else
     {
         FrameworkElement fe = this.Parent as FrameworkElement;
         while (fe != null && fe.GetType() != typeof(Window))
         {
             if (fe.GetType() == typeof(FlyoutStacks))
             {
                 FlyoutStacks flyoutstack = fe as FlyoutStacks;
                 if (flyoutstack.Items.Contains(this) && object.ReferenceEquals(flyoutstack.Items[flyoutstack.Items.Count - 1], this))
                 {
                     flyoutstack.CloseFlyout();
                     return;
                 }
             }
             fe = fe.Parent as FrameworkElement;
         }
     }
 }