void DisplayGrid()
        {
            FrontGrille.Children.Clear();
            var Sudoku = App.SudokuManager.SelectedSudoku;
            if (Sudoku == null) return;
            var tb = new TextBlock {
                Text = Sudoku.Name
            };
            var stateConverter = new StateToColorConverter();
            var grid = new Grid ()
            {
                Background = Sudoku.IsValid
                                ? Sudoku.Resolved
                                    ? Brushes.LightGreen
                                    : Brushes.White
                                : Brushes.Red
            };

            for (var i = 0; i < Sudoku.AreaLineCount; ++i)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                grid.RowDefinitions.Add(new RowDefinition());
            }

            FrontGrille.Children.Add(grid);
            for (var i = 0; i < Sudoku.AreaLineCount; ++i) {
                for (var j = 0; j < Sudoku.AreaLineCount; ++j)
                {
                    var area = Sudoku.AreaLines.ElementAt(i).ElementAt(j);
                    var areaGrid = new Grid(){};
                    for (var x = 0; x < Sudoku.AreaLineCount; ++x)
                    {
                        areaGrid.ColumnDefinitions.Add(new ColumnDefinition());
                        areaGrid.RowDefinitions.Add(new RowDefinition());
                    }

                    var border = new Border
                    {
                        BorderBrush = Brushes.Black,
                        BorderThickness = new Thickness(1),
                        Child = areaGrid
                    };
                    for (var x = 0; x < Sudoku.AreaLineCount; ++x)
                    {
                        for (var y = 0; y < Sudoku.AreaLineCount; ++y)
                        {
                            var cell = area.Lines.ElementAt(y).ElementAt(x);
                            var areaBorder = new Border
                            {
                                BorderThickness = new Thickness(0.25),
                                BorderBrush = Brushes.Black
                            };
                            if (cell.Resolved)
                            {
                                areaBorder.Child = new Viewbox
                                {
                                    Stretch = Stretch.Fill,
                                    Child = new TextBlock
                                    {
                                        Margin = new Thickness(5),
                                        Text = cell.Value.ToString(),
                                        TextAlignment = TextAlignment.Center,
                                        TextWrapping = TextWrapping.Wrap
                                    }
                                };
                            }
                            else
                            {
                                var cellGridSizeX =(int) Math.Ceiling(Math.Sqrt(cell.Hypotheses.Count()));
                                var cellGridSizeY = Math.Ceiling((double)cell.Hypotheses.Count() / cellGridSizeX);
                                var cellGrid = new Grid();
                                for (var z = 0; z < cellGridSizeX; ++z)
                                    cellGrid.ColumnDefinitions.Add(new ColumnDefinition());
                                for (var z = 0; z < cellGridSizeY; ++z)
                                    cellGrid.RowDefinitions.Add(new RowDefinition());
                                var cellX = 0;
                                var cellY = 0;
                                foreach (var hypothesis in cell.Hypotheses)
                                {
                                    var txtHyp = new TextBlock
                                    {
                                        Text = hypothesis.ToString(),
                                        TextAlignment = TextAlignment.Center,
                                        TextWrapping = TextWrapping.Wrap
                                    };
                                    Grid.SetColumn(txtHyp, cellX++);
                                    Grid.SetRow(txtHyp, cellY);
                                    if (cellX == cellGridSizeX) {
                                        cellX = 0;
                                        ++cellY;
                                    }
                                    cellGrid.Children.Add(txtHyp);
                                }
                                areaBorder.Child = cellGrid;
                            }
                            Grid.SetColumn(areaBorder,x);
                            Grid.SetRow(areaBorder, y);
                            areaGrid.Children.Add(areaBorder);
                        }
                    }
                    Grid.SetColumn(border, j);
                    Grid.SetRow(border, i);
                    grid.Children.Add(border);
                }
            }
            TxtSolvingTime.Text = Sudoku.Resolved
                    ? "temps de resolution : " + Sudoku.SolvingTime + " milisecondes"
                    : "";
        }
        void DisplayGrid()
        {
            FrontGrille.Children.Clear();
            var Sudoku = App.SudokuManager.SelectedSudoku;

            if (Sudoku == null)
            {
                return;
            }
            var tb = new TextBlock {
                Text = Sudoku.Name
            };
            var stateConverter = new StateToColorConverter();
            var grid           = new Grid()
            {
                Background = Sudoku.IsValid
                                ? Sudoku.Resolved
                                    ? Brushes.LightGreen
                                    : Brushes.White
                                : Brushes.Red
            };

            for (var i = 0; i < Sudoku.AreaLineCount; ++i)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                grid.RowDefinitions.Add(new RowDefinition());
            }

            FrontGrille.Children.Add(grid);
            for (var i = 0; i < Sudoku.AreaLineCount; ++i)
            {
                for (var j = 0; j < Sudoku.AreaLineCount; ++j)
                {
                    var area     = Sudoku.AreaLines.ElementAt(i).ElementAt(j);
                    var areaGrid = new Grid()
                    {
                    };
                    for (var x = 0; x < Sudoku.AreaLineCount; ++x)
                    {
                        areaGrid.ColumnDefinitions.Add(new ColumnDefinition());
                        areaGrid.RowDefinitions.Add(new RowDefinition());
                    }

                    var border = new Border
                    {
                        BorderBrush     = Brushes.Black,
                        BorderThickness = new Thickness(1),
                        Child           = areaGrid
                    };
                    for (var x = 0; x < Sudoku.AreaLineCount; ++x)
                    {
                        for (var y = 0; y < Sudoku.AreaLineCount; ++y)
                        {
                            var cell       = area.Lines.ElementAt(y).ElementAt(x);
                            var areaBorder = new Border
                            {
                                BorderThickness = new Thickness(0.25),
                                BorderBrush     = Brushes.Black
                            };
                            if (cell.Resolved)
                            {
                                areaBorder.Child = new Viewbox
                                {
                                    Stretch = Stretch.Fill,
                                    Child   = new TextBlock
                                    {
                                        Margin        = new Thickness(5),
                                        Text          = cell.Value.ToString(),
                                        TextAlignment = TextAlignment.Center,
                                        TextWrapping  = TextWrapping.Wrap
                                    }
                                };
                            }
                            else
                            {
                                var cellGridSizeX = (int)Math.Ceiling(Math.Sqrt(cell.Hypotheses.Count()));
                                var cellGridSizeY = Math.Ceiling((double)cell.Hypotheses.Count() / cellGridSizeX);
                                var cellGrid      = new Grid();
                                for (var z = 0; z < cellGridSizeX; ++z)
                                {
                                    cellGrid.ColumnDefinitions.Add(new ColumnDefinition());
                                }
                                for (var z = 0; z < cellGridSizeY; ++z)
                                {
                                    cellGrid.RowDefinitions.Add(new RowDefinition());
                                }
                                var cellX = 0;
                                var cellY = 0;
                                foreach (var hypothesis in cell.Hypotheses)
                                {
                                    var txtHyp = new TextBlock
                                    {
                                        Text          = hypothesis.ToString(),
                                        TextAlignment = TextAlignment.Center,
                                        TextWrapping  = TextWrapping.Wrap
                                    };
                                    Grid.SetColumn(txtHyp, cellX++);
                                    Grid.SetRow(txtHyp, cellY);
                                    if (cellX == cellGridSizeX)
                                    {
                                        cellX = 0;
                                        ++cellY;
                                    }
                                    cellGrid.Children.Add(txtHyp);
                                }
                                areaBorder.Child = cellGrid;
                            }
                            Grid.SetColumn(areaBorder, x);
                            Grid.SetRow(areaBorder, y);
                            areaGrid.Children.Add(areaBorder);
                        }
                    }
                    Grid.SetColumn(border, j);
                    Grid.SetRow(border, i);
                    grid.Children.Add(border);
                }
            }
            TxtSolvingTime.Text = Sudoku.Resolved
                    ? "temps de resolution : " + Sudoku.SolvingTime + " milisecondes"
                    : "";
        }