protected void prepareLegend(MatrixIncViewModel vm) { for (int x = 0; x < vm.NodeCount; ++x) { var Label = new MatrixControlItem(); var ivm = new MatrixItemViewModel() { Text = (x + 1).ToString(), Hint = "", Background = new SolidColorBrush(Colors.Gray), }; Label.DataContext = ivm; MatrixIncGrid.Children.Add(Label); Grid.SetRow(Label, 0); Grid.SetColumn(Label, x + 1); } for (int y = 0; y < vm.ConnectionCount; ++y) { var Label = new MatrixControlItem(); var ivm = new MatrixItemViewModel() { Text = (y + 1).ToString(), Hint = "", Background = new SolidColorBrush(Colors.Gray) }; Label.DataContext = ivm; MatrixIncGrid.Children.Add(Label); Grid.SetRow(Label, y + 1); Grid.SetColumn(Label, 0); } }
protected virtual void createLabels(MatrixIncViewModel vm) { for (int node = 0; node < vm.NodeCount; ++node) { for (int connection = 0; connection < vm.ConnectionCount; ++connection) { MatrixControlItem item = new MatrixControlItem(); var ivm = new MatrixItemViewModel() { Text = vm.Connections[node, connection].ToString(), Background = vm.Connections[node, connection] != 0 ? new SolidColorBrush(Color.FromArgb(50, 0, 255, 0)) : new SolidColorBrush(Colors.Transparent), Visibility = Visibility.Collapsed, Hint = string.Format("[{0}, {1}] - {2}", connection, node, vm.Connections[node, connection]) }; item.DataContext = ivm; MatrixIncGrid.Children.Add(item); Grid.SetRow(item, connection + 1); Grid.SetColumn(item, node + 1); } } }
protected virtual void createLabels(MatrixViewModel vm) { for (int y = 0; y < vm.NodeCount; ++y) { for (int x = 0; x < vm.NodeCount; ++x) { MatrixControlItem item = new MatrixControlItem(); var ivm = new MatrixItemViewModel() { Text = vm.Connections[x, y].ToString(), Background = vm.Connections[x, y] != 0 ? new SolidColorBrush(Color.FromArgb(50, 0, 255, 0)) : new SolidColorBrush(Colors.Transparent), Visibility = vm.NodeCount <= 7 ? Visibility.Visible : Visibility.Collapsed, Hint = string.Format("[{0}, {1}] - {2}", x, y, vm.Connections[x, y]) }; item.DataContext = ivm; MatrixGrid.Children.Add(item); Grid.SetRow(item, y + 1); Grid.SetColumn(item, x + 1); } } }