|
private void FillFrontGrid(Grid gridObj)
{
gridObj.RowDefinitions.Clear();
RowDefinition rd = new RowDefinition();
rd.Height = new GridLength();
gridObj.RowDefinitions.Add(rd);
for (int i = 0; i < gridObj.RowDefinitions.Count; i++)
{
for (int j = 0; j < gridObj.ColumnDefinitions.Count; j++)
{
var border = new Label();
border.BorderThickness = new Thickness(1);
border.BorderBrush = Brushes.White;
border.Margin = new Thickness(0);
border.HorizontalContentAlignment = HorizontalAlignment.Center;
border.Content = _dictionary.Values.ToList()[i * gridObj.ColumnDefinitions.Count + j];
//border.Margin = new Thickness(8, 8, 8, 8);
border.Width = (gridObj.ActualWidth/* - 140*/) / gridObj.ColumnDefinitions.Count;
border.Height = (gridObj.ActualHeight/* - 95*/) / gridObj.RowDefinitions.Count;
//border.Background = new SolidColorBrush(_dictionary.Keys.ToList()[i * gridObj.ColumnDefinitions.Count + j]);
border.ToolTip = _dictionary.Values.ToList()[i * gridObj.ColumnDefinitions.Count + j];
border.MouseDown += new System.Windows.Input.MouseButtonEventHandler(colorLabel_MouseDown);
Grid.SetRow(border, i);
Grid.SetColumn(border, j);
gridObj.SafeAddChild(border);
}
}
} |
|