private void XpanderPanelPanelStyleChanged(object sender, PanelStyleChangeEventArgs e)
        {
            var panelStyle = e.PanelStyle;

            if (panelStyle != m_ePanelStyle)
            {
                PanelStyle = panelStyle;
            }
        }
        /// <summary>
        /// Raises the PanelStyle changed event
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A PanelStyleChangeEventArgs that contains the event data.</param>
        protected virtual void OnPanelStyleChanged(object sender, PanelStyleChangeEventArgs e)
        {
            var panelStyle = e.PanelStyle;

            Padding = new Padding(0);

            foreach (XPanderPanel xpanderPanel in XPanderPanels)
            {
                var propertyDescriptorCollection = TypeDescriptor.GetProperties(xpanderPanel);
                if (propertyDescriptorCollection.Count > 0)
                {
                    var propertyDescriptorPanelStyle = propertyDescriptorCollection["PanelStyle"];
                    if (propertyDescriptorPanelStyle != null)
                    {
                        propertyDescriptorPanelStyle.SetValue(xpanderPanel, panelStyle);
                    }
                    var propertyDescriptorLeft = propertyDescriptorCollection["Left"];
                    if (propertyDescriptorLeft != null)
                    {
                        propertyDescriptorLeft.SetValue(xpanderPanel, Padding.Left);
                    }
                    var propertyDescriptorWidth = propertyDescriptorCollection["Width"];
                    if (propertyDescriptorWidth != null)
                    {
                        propertyDescriptorWidth.SetValue(
                            xpanderPanel,
                            ClientRectangle.Width
                            - Padding.Left
                            - Padding.Right);
                    }
                }
            }
            if (PanelStyleChanged != null)
            {
                PanelStyleChanged(sender, e);
            }
        }
Exemple #3
0
 /// <summary>
 /// Raises the PanelStyleChanged event
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">A EventArgs that contains the event data.</param>
 protected override void OnPanelStyleChanged(object sender, PanelStyleChangeEventArgs e)
 {
     OnLayout(new LayoutEventArgs(this, null));
     base.OnPanelStyleChanged(sender, e);
 }