<summary>
Add a border line to a grid
</summary>
<param name= "Grid" ></param>
public static void Insertframeforgrid (grid grid)
{
var Rowcon = grid. Rowdefinitions.count;
var Clcon = grid. Columndefinitions.count;
for (var i = 0; i < Rowcon + 1; i++)//Line Loop add border
{
var border = new border
{
BorderBrush = new SolidColorBrush (Colors.slategray),
BorderThickness = i = = Rowcon? New Thickness (0, 0, 0, 1): New Thickness (0, 1, 0, 0)
};
Grid.setrow (border, i);
Grid.setcolumnspan (border, Clcon);
Grid. Children.add (border);
}
for (var j = 0; J < Clcon + 1; j + +)//column loop add border
{
var border = new border
{
BorderBrush = new SolidColorBrush (Colors.slategray),
BorderThickness = j = = Clcon? New Thickness (0, 0, 1, 0): New Thickness (1, 0, 0, 0)
};
Grid.setcolumn (Border, J);
Grid.setrowspan (border, Rowcon);
Grid. Children.add (border);
}
}
Grid implementation grids in WPF, Table Style Universal Class (GO)