/// <summary>
 ///     This will retrieve the Watermark from any derived class and force our
 ///     container to update the text.
 /// </summary>
 protected void ForceWatermarkTextChange()
 {
     if (_containerControl != null)
     {
         _containerControl.SetWatermarkInfo(WatermarkInfo);
     }
 }
        /// <summary>
        ///     Overriden to create the VirtualTreeControl hosted in the tool window
        /// </summary>
        /// <returns></returns>
        protected override void OnToolWindowCreate()
        {
            Debug.Assert(_containerControl == null, "containerControl should be null at the beginning of OnCreate");

            // set up tree data
            _treeProvider = new VariableColumnTree(1);

            // set up tree control
            _treeControl = new TreeGridDesignerTreeControl(this);
            _treeControl.SelectionMode    = SelectionMode.One;
            _treeControl.LabelEditSupport = VirtualTreeLabelEditActivationStyles.ImmediateMouse
                                            | VirtualTreeLabelEditActivationStyles.Explicit;
            _treeControl.HasHorizontalGridLines   = true;
            _treeControl.HasVerticalGridLines     = false;
            _treeControl.ShowToolTips             = true;
            _treeControl.MultiColumnTree          = _treeProvider as IMultiColumnTree;
            _treeControl.IsDragSource             = false;
            _treeControl.MultiColumnHighlight     = true;
            _treeControl.StandardCheckBoxes       = true;
            _treeControl.SelectionChanged        += OnTreeSelectionChanged;
            _treeControl.LabelEditControlChanged += OnLabelEditControlChanged;
            _treeControl.Site = new TreeGridDesignerSite(this);
            _treeControl.ContextMenuInvoked += OnContextMenu;

            var defaultColumnsCollection = DefaultColumns;

            if (defaultColumnsCollection != null)
            {
                _treeControl.DefaultColumns = defaultColumnsCollection;
            }

            // create container control which handles the watermark
            _containerControl = CreateContainer();
            _containerControl.SetWatermarkInfo(WatermarkInfo);
            _containerControl.WatermarkVisible         = true;
            _containerControl.AccessibilityObject.Name = AccessibilityName;

            // Listen for user preference changes.  We use this to update our fonts due to high-contrast changes.
            SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;

            // we always want focus rectangles to be drawn
            NativeMethods.SendMessage(
                _treeControl.Handle, NativeMethods.WM_UPDATEUISTATE, (NativeMethods.UIS_CLEAR | (NativeMethods.UISF_HIDEFOCUS << 16)), 0);

            vsEventBroadcaster = new VSEventBroadcaster(this);
            vsEventBroadcaster.Initialize();
            vsEventBroadcaster.OnFontChanged += vsEventBroadcaster_OnFontChanged;

            // set the font based on VS settings
            SetFonts();

            SetTreeControlThemedColors();

            VSColorTheme.ThemeChanged += VSColorTheme_ThemeChanged;
        }
        /// <summary>
        ///     Overriden to create the VirtualTreeControl hosted in the tool window
        /// </summary>
        /// <returns></returns>
        protected override void OnToolWindowCreate()
        {
            Debug.Assert(_containerControl == null, "containerControl should be null at the beginning of OnCreate");

            // set up tree data
            _treeProvider = new VariableColumnTree(1);

            // set up tree control
            _treeControl = new TreeGridDesignerTreeControl(this);
            _treeControl.SelectionMode = SelectionMode.One;
            _treeControl.LabelEditSupport = VirtualTreeLabelEditActivationStyles.ImmediateMouse
                                            | VirtualTreeLabelEditActivationStyles.Explicit;
            _treeControl.HasHorizontalGridLines = true;
            _treeControl.HasVerticalGridLines = false;
            _treeControl.ShowToolTips = true;
            _treeControl.MultiColumnTree = _treeProvider as IMultiColumnTree;
            _treeControl.IsDragSource = false;
            _treeControl.MultiColumnHighlight = true;
            _treeControl.StandardCheckBoxes = true;
            _treeControl.SelectionChanged += OnTreeSelectionChanged;
            _treeControl.LabelEditControlChanged += OnLabelEditControlChanged;
            _treeControl.Site = new TreeGridDesignerSite(this);
            _treeControl.ContextMenuInvoked += OnContextMenu;

            var defaultColumnsCollection = DefaultColumns;
            if (defaultColumnsCollection != null)
            {
                _treeControl.DefaultColumns = defaultColumnsCollection;
            }

            // create container control which handles the watermark
            _containerControl = CreateContainer();
            _containerControl.SetWatermarkInfo(WatermarkInfo);
            _containerControl.WatermarkVisible = true;
            _containerControl.AccessibilityObject.Name = AccessibilityName;

            // Listen for user preference changes.  We use this to update our fonts due to high-contrast changes.
            SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;

            // we always want focus rectangles to be drawn
            NativeMethods.SendMessage(
                _treeControl.Handle, NativeMethods.WM_UPDATEUISTATE, (NativeMethods.UIS_CLEAR | (NativeMethods.UISF_HIDEFOCUS << 16)), 0);

            vsEventBroadcaster = new VSEventBroadcaster(this);
            vsEventBroadcaster.Initialize();
            vsEventBroadcaster.OnFontChanged += vsEventBroadcaster_OnFontChanged;

            // set the font based on VS settings
            SetFonts();

            SetTreeControlThemedColors();

            VSColorTheme.ThemeChanged += VSColorTheme_ThemeChanged;
        }