public void SetLinePattern(
     DependencyObject obj,
     LinePattern value)
 {
     obj.SetValue(LinePatternProperty, value);
 }
示例#2
0
        private Pen GetBorderPen(IEnumerable<Pen> pens,
            Color color, int width, LinePattern pattern)
        {
            if (color.IsEmpty == true ||
                pattern == LinePattern.None || width <= 0)
            {
                return (null);
            }

            foreach (Pen pen in pens)
            {
                if (pen != null)
                {
                    if (pen.Color == color && pen.Width == width &&
                        pen.DashStyle == (DashStyle)pattern)
                    {
                        return (pen);
                    }
                }
            }

            Pen npen = new Pen(color, width);

            if (pattern == LinePattern.NotSet)
                pattern = LinePattern.Solid;

            npen.DashStyle = (DashStyle)pattern;

            return (npen);
        }
        /// <summary>
        /// Applies the style to instance of this style.
        /// </summary>
        /// <param name="style">Style to apply.</param>
        public void ApplyStyle(GridPanelVisualStyle style)
        {
            if (style != null)
            {
                base.ApplyStyle(style);

                if (style.Alignment != Alignment.NotSet)
                    _Alignment = style.Alignment;

                if (style.AllowWrap != Tbool.NotSet)
                    _AllowWrap = style.AllowWrap;

                if (style._CircleTreeButtonStyle != null)
                    CircleTreeButtonStyle.ApplyStyle(style._CircleTreeButtonStyle);

                if (style.HeaderLineColor.IsEmpty == false)
                    _HeaderLineColor = style.HeaderLineColor;

                if (style.TreeLineColor.IsEmpty == false)
                    _TreeLineColor = style.TreeLineColor;

                if (style.HorizontalLineColor.IsEmpty == false)
                    _HorizontalLineColor = style.HorizontalLineColor;

                if (style.VerticalLineColor.IsEmpty == false)
                    _VerticalLineColor = style.VerticalLineColor;

                if (style.TreeLinePattern != LinePattern.NotSet)
                    TreeLinePattern = style.TreeLinePattern;

                if (style.HorizontalLinePattern != LinePattern.NotSet)
                    HorizontalLinePattern = style.HorizontalLinePattern;

                if (style._SquareTreeButtonStyle != null)
                    SquareTreeButtonStyle.ApplyStyle(style._SquareTreeButtonStyle);

                if (style._TriangleTreeButtonStyle != null)
                    TriangleTreeButtonStyle.ApplyStyle(style._TriangleTreeButtonStyle);
                
                if (style.VerticalLinePattern != LinePattern.NotSet)
                    VerticalLinePattern = style.VerticalLinePattern;

                if (style.HeaderHLinePattern != LinePattern.NotSet)
                    HeaderHLinePattern = style.HeaderHLinePattern;

                if (style.HeaderVLinePattern != LinePattern.NotSet)
                    HeaderVLinePattern = style.HeaderVLinePattern;
            }
        }