private void HideSelfAndChildren()
 {
     if (_popup != null)
     {
         _popup.IsOpen = false;
         ArrayControl child = ChildArray;
         if (child != null)
         {
             child.HideSelfAndChildren();
         }
     }
 }
        public void ShowArrayPopup(UIElement target, Array data, string popupTooltipPrefix, Color backgroundColor)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (_popup == null)
            {
                InitPopup(backgroundColor);
            }

            HideSelfAndChildren();

            ArrayControl arrCtl = GetArrayControl(data.Rank);

            if (arrCtl != null)
            {
                arrCtl.LeftBracket  = LeftBracket;
                arrCtl.RightBracket = RightBracket;

                arrCtl.CaptionBuilder = _captionBuilder;
                arrCtl.CellClick      = CellClick;
                arrCtl.Formatter      = _formatter;
                arrCtl.CellHeight     = CellHeight;
                arrCtl.CellWidth      = CellWidth;
                arrCtl.SetControlData(data, popupTooltipPrefix);

                arrCtl.Padding = new Thickness(8);
                arrCtl.Width  += 16;
                arrCtl.Height += 16;

                _arrayContainer.Content = arrCtl;
                if (_popup != null)
                {
                    _popup.PlacementTarget = target;
                    _popup.IsOpen          = true;
                }
            }
        }