/// <summary> /// On resize of the window, we want to show as many as possible phone numbers /// </summary> private void CreateGridBasedOnSize() { MainWindow MainObject = (MainWindow)App.Current.MainWindow; GridContentArea grid = this.DrawArea; grid.ClearContent(); //get the number of rows and columns this grid should have double CellsFitInWidth = grid.GetGridCellsWidth(); double CellsFitInHeight = grid.GetGridCellsHeight(); //generate new grid content based on the size of the window for (int cols = 0; cols < (int)CellsFitInWidth; cols++) { for (int rows = 0; rows < (int)CellsFitInHeight; rows++) { PhoneNumberAdd(cols, rows); } } }
/// <summary> /// On resize of the window, we want to show as many as possible phone numbers /// </summary> private void CreateGridBasedOnSize() { //maybe we should not redraw everything all the time. If tab switching is slow, remake this GridContentArea grid = this.DrawArea; grid.ClearContent(); //get the number of rows and columns this grid should have int CellsFitInWidth = grid.GetCellsInWidth(); int CellsFitInHeight = grid.GetCellsInHeight(); //generate new grid content based on the size of the window for (int cols = 0; cols < (int)CellsFitInWidth; cols++) { for (int rows = 0; rows < (int)CellsFitInHeight; rows++) { PhoneNumberAdd(cols, rows); } } }