Пример #1
0
        /// <summary>
        /// get panel below splitter
        /// </summary>
        /// <param name="splitter"></param>
        /// <returns></returns>
        public Panel GetPanelBySplitter(SplitterWithExpander splitter)
        {
            int   index = this.Controls.GetChildIndex(splitter);
            Panel panel = this.Controls[index - 1] as Panel; // get the panel below splitter

            return(panel);
        }
Пример #2
0
        /// <summary>
        /// create splitter with expander
        /// </summary>
        /// <returns></returns>
        protected override Splitter CreateDefaultSplitterControl(string name)
        {
            IDesignerHost        host     = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
            SplitterWithExpander splitter = host.CreateComponent(typeof(SplitterWithExpander)) as SplitterWithExpander;

            splitter.Initialize(SplitterThinkness, name);
            splitter.PropertyChanged += Splitter_PropertyChanged;
            return(splitter);
        }
Пример #3
0
 /// <summary>
 /// set the visibility of panel when expander is expanded/ collapsed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Splitter_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IsExpanded")
     {
         SplitterWithExpander splitterWithExpander = ((SplitterWithExpander)(sender));
         Panel panel = GetPanelBySplitter(splitterWithExpander);
         panel.Visible = splitterWithExpander.IsExpanded; // set the visibility of panel
         OnIsExpandedChangedChanged(panel);               // raise isexpanded changed event
     }
 }
Пример #4
0
        /// <summary>
        /// Show the panel if it is not visible
        /// </summary>
        /// <param name="panel"></param>
        public void EnsureExpanded(Panel panel)
        {
            if (!panel.Visible)
            {
                int index = Controls.GetChildIndex(panel);
                SplitterWithExpander splitterWithExpander = Controls[index + 1] as SplitterWithExpander;

                splitterWithExpander.IsExpanded = true;
            }
        }
Пример #5
0
        protected override bool GetHitTest(Point point)
        {
            SplitterWithExpander splitter = this.Component as SplitterWithExpander;
            bool result = base.GetHitTest(point);

            point = splitter.PointToClient(point);
            SplitterHitTestArea hitTestResult = splitter.HitTest(point);

            if (hitTestResult == SplitterHitTestArea.Expander)
            {
                return(true);
            }
            return(false);
        }
Пример #6
0
        /// <summary>
        /// update the text of splitter
        /// </summary>
        /// <param name="index"></param>
        /// <param name="text"></param>
        public void UpdateSplitterText(int index, string text)
        {
            SplitterWithExpander splitter = Splitters[index] as SplitterWithExpander;

            splitter.UpdateText(text);
        }