示例#1
0
        public static Rectangle CustomRectangle(CustomRectangleStyle customRectangleStyle)
        {
            Rectangle rectangle = new Rectangle();

            if (customRectangleStyle == CustomRectangleStyle.blueLines)
            {
                rectangle = new Rectangle()
                {
                    Fill            = Brushes.Transparent,
                    Stroke          = (SolidColorBrush)(new BrushConverter().ConvertFrom("#1f3861")),
                    StrokeThickness = 2
                };
            }
            else if (customRectangleStyle == CustomRectangleStyle.grayLines)
            {
                rectangle = new Rectangle()
                {
                    Fill            = Brushes.Transparent,
                    Stroke          = (SolidColorBrush)(new BrushConverter().ConvertFrom("#999999")),
                    StrokeThickness = 0.5
                };
            }
            return(rectangle);
        }
示例#2
0
 public void CreateClickableGridBorders(Grid grid, CustomRectangleStyle customRectangleStyle)
 {
     if (grid != null)
     {
         int columnAmount = grid.ColumnDefinitions.Count;
         int rowAmount    = grid.RowDefinitions.Count;
         int xCoordinate  = 0;
         int yCoordinate  = 0;
         while (yCoordinate < rowAmount)
         {
             xCoordinate = 0;
             while (xCoordinate < columnAmount)
             {
                 Rectangle rectangleDayBorder = CustomRectangle(customRectangleStyle);
                 rectangleDayBorder.MouseDown += RectangleDayBorder_MouseDown;
                 Grid.SetColumn(rectangleDayBorder, xCoordinate);
                 Grid.SetRow(rectangleDayBorder, yCoordinate);
                 grid.Children.Add(rectangleDayBorder);
                 xCoordinate++;
             }
             yCoordinate++;
         }
     }
 }