How can be done a 2D of 10x10 selectable elements each element with text in a windows form? Is there an easy way of doing this?
I need to select some elements in an
Posting this as an answer because the OP asked for it:
    
         
         
         
     
    
         
        
            
                
                    
                        
                            
                                 
                                 
                             
                         
                     
                 
             
         
     
    
        
            
                
                     
                 
             
            
                
                    
                        
                     
                 
             
         
        
     
 
 
Code Behind:
public partial class GridRobot : Window
{
    public GridRobot()
    {
        InitializeComponent();
        DataContext = new GridRobotViewModel();
    }
}
View Model:
public class GridRobotViewModel: PropertyChangedBase
{
    private int _size;
    public int Size
    {
        get { return _size; }
        set
        {
            _size = value;
            OnPropertyChanged("Size");
            CreateItems();
        }
    }
    private ObservableCollection _squares;
    public ObservableCollection Squares
    {
        get { return _squares ?? (_squares = new ObservableCollection()); }
    }
    private ObservableCollection _route;
    public ObservableCollection Route
    {
        get { return _route ?? (_route = new ObservableCollection()); }
    }
    private void CreateItems()
    {
        Squares.Clear();
        Route.Clear();
        for (int i = 0; i < Size; i++)
        {
            for (int j = 0; j < Size; j++)
            {
                Squares.Add(new GridItem() {Row = i, Column = j});
            }
        }
    }
    private Command _goToCommand;
    public Command GoToCommand
    {
        get { return _goToCommand ?? (_goToCommand = new Command(Goto){IsEnabled = true}); }
    }
    private void Goto(GridItem item)
    {
        if (item.PathIndex == null)
        {
            item.PathIndex = Squares.Max(x => x.PathIndex ?? 0) + 1;
            Route.Add(item);    
        }
    }
}
         
Data Item:
public class GridItem: PropertyChangedBase
{
    public int Row { get; set; }
    public int Column { get; set; }
    private int? _pathIndex;
    public int? PathIndex
    {
        get { return _pathIndex; }
        set
        {
            _pathIndex = value;
            OnPropertyChanged("PathIndex");
        }
    }
}
Support Classes for MVVM:
public class PropertyChangedBase:INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    protected virtual void OnPropertyChanged(string propertyName)
    {
        Application.Current.Dispatcher.BeginInvoke((Action) (() =>
            {
                PropertyChangedEventHandler handler = PropertyChanged;
                if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
            }));
    }
}
public class Command: ICommand
{
    public Action Action { get; set; }
    public void Execute(object parameter)
    {
        if (Action != null && parameter is T)
            Action((T)parameter);
    }
    public bool CanExecute(object parameter)
    {
        return IsEnabled;
    }
    private bool _isEnabled;
    public bool IsEnabled
    {
        get { return _isEnabled; }
        set
        {
            _isEnabled = value;
            if (CanExecuteChanged != null)
                CanExecuteChanged(this, EventArgs.Empty);
        }
    }
    public event EventHandler CanExecuteChanged;
    public Command(Action action)
    {
        Action = action;
    }
}
   
Result:

File -> New Project -> WPF Application and see the results for yourself.