Exemplo n.º 1
0
        protected override void CreateChildItems(RadElement parent)
        {
            this.tabStripElement = new RadTabStripElement();
            this.RootElement.Children.Add(this.tabStripElement);

            this.tabStripElement.Items.ItemsChanged += new ItemChangedDelegate(this.Items_ItemsChanged);
            this.tabStripElement.TabSelected        += new TabEventHandler(this.tabStripElement_TabSelected);

            this.tabStripElement.TabSelecting    += delegate(object sender, TabCancelEventArgs args) { this.OnTabSelecting(args); };
            this.tabStripElement.TabDragEnded    += delegate(object sender, TabDragEventArgs args) { this.OnTabDragEnded(args); };
            this.tabStripElement.TabDragEnding   += delegate(object sender, TabDragCancelEventArgs args) { this.OnTabDragEnding(args); };
            this.tabStripElement.TabDragStarted  += delegate(object sender, TabDragEventArgs args) { this.OnTabDragStarted(args); };
            this.tabStripElement.TabDragStarting += delegate(object sender, TabDragCancelEventArgs args) { this.OnTabDragStarting(args); };

            this.tabStripElement.TabSelected += delegate(object sender, TabEventArgs args) { this.OnTabSelected(args); };
            this.tabStripElement.TabHovered  += delegate(object sender, TabEventArgs args) { this.OnTabHovered(args); };

            this.tabStripElement.TabsPositionChanged       += delegate(object sender, EventArgs args) { this.OnTabsPositionChanged(args); };
            this.tabStripElement.AllTabsEqualHeightChanged += delegate(object sender, EventArgs args) { this.OnAllTabsEqualHeightChanged(args); };
            this.tabStripElement.TextOrientationChanged    += delegate(object sender, EventArgs args) { this.OnTextOrientationChanged(args); };

            this.tabStripElement.RadPropertyChanged += new RadPropertyChangedEventHandler(this.tabStripElement_RadPropertyChanged);

            this.ElementTree.PerformInnerLayout(true, 0, 0, this.DefaultSize.Width, this.DefaultSize.Height);
        }
Exemplo n.º 2
0
        protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            if (e.Property == VisibilityProperty)
            {
                OnVisibilityChanged(EventArgs.Empty);

                if (!this.IsInValidState(true))
                {
                    return;
                }

                if (this.ElementTree.Control as RadTabStrip != null)
                {
                    RadTabStrip tabStrip = this.ElementTree.Control as RadTabStrip;
                    if (tabStrip != null)
                    {
                        if (tabStrip.EnableTabControlMode && this.ContentPanel != null)
                        {
                            ElementVisibility newValue = (ElementVisibility)e.NewValue;
                            if (newValue == ElementVisibility.Visible)
                            {
                                this.ContentPanelHost.Visibility = ElementVisibility.Visible;
                            }
                            else
                            {
                                this.ContentPanelHost.Visibility = ElementVisibility.Hidden;
                            }
                        }
                    }
                }
            }
            else if (e.Property == IsMouseOverProperty)
            {
                this.ParentTabStrip.CallOnTabHovered(new TabEventArgs(this));
            }
            else if (e.Property == EnabledProperty)
            {
                this.ContentPanel.Enabled = (bool)e.NewValue;
            }
            else if (e.Property == TextProperty || e.Property == ImageProperty)
            {
                // PATCH
                if (this.layout != null)
                {
                    this.layout.PerformLayout();

                    if (this.ParentTabStrip != null)
                    {
                        if (this.ParentTabStrip.BoxLayout != null)
                        {
                            this.ParentTabStrip.BoxLayout.PerformLayout();
                        }
                    }
                }
            }
            else if (e.Property == RadTabStripElement.IsSelectedProperty)
            {
                this.UpdateMargins();
            }

            if (this.UseNewLayoutSystem)
            {
                RadTabStripElement tabStripElement = this.ParentTabStrip;
                if (tabStripElement != null)
                {
                    if (e.Property == RadElement.StretchHorizontallyProperty)
                    {
                        if (tabStripElement.TabsPosition == TabPositions.Top || tabStripElement.TabsPosition == TabPositions.Bottom)
                        {
                            bool stretchText = (bool)e.NewValue;
                            this.layout.StretchHorizontally = stretchText;
                            //TODO:
                            //this.TextPrimitive.StretchHorizontally = stretchText;
                        }
                    }
                    if (e.Property == RadElement.StretchVerticallyProperty)
                    {
                        if (tabStripElement.TabsPosition == TabPositions.Left || tabStripElement.TabsPosition == TabPositions.Right)
                        {
                            bool stretchText = (bool)e.NewValue;
                            this.layout.StretchHorizontally = stretchText;
                        }
                    }
                }
            }

            base.OnPropertyChanged(e);
        }