Exemple #1
0
        void checkCollapsed_ToggleStateChanged(object sender, StateChangedEventArgs args)
        {
            ((SplitPanel)this.radTreeView1.SelectedNode.Tag).Collapsed = this.checkCollapsed.ToggleState == ToggleState.On;

            RadTreeNode splitContNode = this.radTreeView1.SelectedNode.Parent;

            Telerik.WinControls.UI.RadSplitContainer splitContainer = (Telerik.WinControls.UI.RadSplitContainer)splitContNode.Tag;

            bool canRemoveNode = true;

            while (canRemoveNode)
            {
                if (splitContNode.Nodes[splitContNode.Nodes.Count - 1].Tag is SplitterElement)
                {
                    splitContNode.Nodes.RemoveAt(splitContNode.Nodes.Count - 1);
                }
                else
                {
                    canRemoveNode = false;
                }
            }

            for (int i = 0; i < splitContainer.Splitters.Count; i++)
            {
                RadTreeNode node = new RadTreeNode(string.Format("Splitter{0}", i + 1));
                node.Tag = splitContainer.Splitters[i];
                splitContNode.Nodes.Add(node);
            }
        }
Exemple #2
0
        public override RadElement GetChildAt(int index)
        {
            RadSplitContainer control = this.ElementTree.Control as RadSplitContainer;

            if (control != null && this.Count != control.VisiblePanelCount)
            {
                control.LayoutInternal();
            }
            return(base.GetChildAt(index));
        }
Exemple #3
0
        private void LoadSplitContainerProperties(Telerik.WinControls.UI.RadSplitContainer splitContainer)
        {
            if (splitContainer.Orientation == Orientation.Horizontal)
            {
                this.radioHorizontal.ToggleState = ToggleState.On;
            }
            else
            {
                this.radioVertical.ToggleState = ToggleState.On;
            }

            ((BorderPrimitive)((RadPanel)splitContainer.Parent).PanelElement.Children[1]).ForeColor = Color.Red;
        }
        protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            if (e.Property == SplitterWidthProperty && this.ElementState == ElementState.Loaded)
            {
                RadSplitContainer container = this.ElementTree.Control as RadSplitContainer;
                if (container != null)
                {
                    container.ApplySplitterWidth((int)e.NewValue);
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Applies the desired splitter width across all splitters and delegates the event to all descendant RadSplitContainer instances.
        /// </summary>
        /// <param name="splitterWidth"></param>
        protected internal virtual void ApplySplitterWidth(int splitterWidth)
        {
            foreach (SplitterElement splitter in this.splitContainerElement.Children)
            {
                splitter.SplitterWidth = splitterWidth;
            }

            for (int i = 0; i < this.panels.Count; i++)
            {
                RadSplitContainer container = this.panels[i] as RadSplitContainer;
                if (container != null)
                {
                    container.splitContainerElement.SetDefaultValueOverride(SplitContainerElement.SplitterWidthProperty, splitterWidth);
                }
            }

            this.PerformLayout();
        }
Exemple #6
0
 public ControlCollection(RadSplitContainer owner)
     : base(owner)
 {
     this.owner = owner;
 }
Exemple #7
0
        /// <summary>
        /// Provides a routine which merges a container with its parent (if appropriate).
        /// The purpose of this logic is to remove internally created containers when they are not needed.
        /// </summary>
        protected internal virtual bool MergeWithParentContainer()
        {
            this.UpdateCollapsed();
            //only internally created split containers are target of automatic clean-up
            if (!this.isCleanUpTarget)
            {
                return(false);
            }

            if (this.panels.Count == 0)
            {
                this.Dispose();
                return(true);
            }

            RadSplitContainer parentContainer = this.Parent as RadSplitContainer;

            if (parentContainer == null)
            {
                return(false);
            }

            //we have one child panel, add it to our parent
            if (this.panels.Count == 1)
            {
                //remember at which position are we and what size we have
                int  index    = parentContainer.SplitPanels.IndexOf(this);
                Size currSize = this.Size;

                //detach ourselves from the parent
                this.Parent = null;
                SplitPanel child = this.panels[0];

                child.Parent = null;
                child.Size   = currSize;

                parentContainer.panels.Insert(index, child);

                return(true);
            }

            //since we are the only child in our parent,
            //we simply remove ourselves and add our children to our parent
            if (parentContainer.SplitPanels.Count == 1)
            {
                //do not forget to get set orientation for the container we are merging with
                parentContainer.Orientation = this.Orientation;
                List <SplitPanel> children = ControlHelper.GetChildControls <SplitPanel>(this, false);
                //remove ourselves from Parent's panels
                this.Parent = null;
                this.SplitPanels.Clear();
                //add all our children to our parent
                foreach (SplitPanel child in children)
                {
                    parentContainer.SplitPanels.Add(child);
                }

                return(true);
            }

            //now check for equal orientation - we do not want nested containers with equal orientation
            if (parentContainer.Orientation == this.orientation)
            {
                //get all our children and add them to the parent container
                int index = parentContainer.SplitPanels.IndexOf(this);
                List <SplitPanel> children = ControlHelper.GetChildControls <SplitPanel>(this, false);

                this.Parent = null;
                this.SplitPanels.Clear();

                foreach (SplitPanel child in children)
                {
                    parentContainer.SplitPanels.Insert(index++, child);
                }

                return(true);
            }

            return(false);
        }
Exemple #8
0
 public SplitPanelCollection(RadSplitContainer owner)
 {
     this.owner = owner;
 }
Exemple #9
0
 internal SplitterCollection(RadSplitContainer owner)
 {
     this.owner = owner;
 }