GetBorderWidth() публичный Метод

Gets the border width.
public GetBorderWidth ( PaletteState state ) : int
state PaletteState Palette value should be applicable to this state.
Результат int
Пример #1
0
        /// <summary>
        /// Discover the preferred size of the element.
        /// </summary>
        /// <param name="context">Layout context.</param>
        public override Size GetPreferredSize(ViewLayoutContext context)
        {
            Debug.Assert(context != null);

            // We have no preferred size by default
            Size preferredSize = Size.Empty;

            // Apply the border width in appropriate orientation
            if (Orientation == Orientation.Horizontal)
            {
                preferredSize.Height = _palette.GetBorderWidth(State);
            }
            else
            {
                preferredSize.Width = _palette.GetBorderWidth(State);
            }

            return(preferredSize);
        }
Пример #2
0
        /// <summary>
        /// Get the preferred size of the control based on a proposed size.
        /// </summary>
        /// <param name="proposedSize">Starting size proposed by the caller.</param>
        /// <returns>Calculated preferred size.</returns>
        public override Size GetPreferredSize(Size proposedSize)
        {
            // Let base class continue with standard calculations
            proposedSize = base.GetPreferredSize(proposedSize);

            // Do we need to apply the border width?
            if (AutoSize)
            {
                if (Orientation == Orientation.Horizontal)
                {
                    proposedSize.Height = _stateCurrent.GetBorderWidth(_state);
                }
                else
                {
                    proposedSize.Width = _stateCurrent.GetBorderWidth(_state);
                }
            }

            return(proposedSize);
        }
Пример #3
0
        /// <summary>
        /// Gets the border width.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Integer width.</returns>
        public override int GetBorderWidth(PaletteBorderStyle style, PaletteState state)
        {
            PaletteBorderEdge inherit = GetInherit(state);

            if (inherit != null)
            {
                return(inherit.GetBorderWidth(state));
            }
            else
            {
                return(Target.GetBorderWidth(style, state));
            }
        }
Пример #4
0
        /// <summary>
        /// Gets the border width.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Integer width.</returns>
        public override int GetBorderWidth(PaletteBorderStyle style, PaletteState state)
        {
            PaletteBorderEdge inherit = GetInherit(state);

            return(inherit?.GetBorderWidth(state) ?? Target.GetBorderWidth(style, state));
        }