public void BuildPage(Pivot mypivot)
{
foreach (Tab tab_i in tabs)
{
List<Section> sectionsOfTab_i = sectionsByTab[tab_i];
Grid grid = new Grid();
int numRow = 0;
foreach (Section section_i in sectionsOfTab_i) // ici on a toute les sections
{
string sectionName = section_i.name;
if (!sectionName.Equals(""))
{
grid.RowDefinitions.Add(new RowDefinition() { Height = System.Windows.GridLength.Auto });
var textBlock = new TextBlock() { Text = sectionName, FontSize = 30 };
Grid.SetRow(textBlock, numRow);
grid.Children.Add(textBlock);
numRow++;
grid.RowDefinitions.Add(new RowDefinition() { Height = System.Windows.GridLength.Auto });
var border = new Border() { BorderBrush = new SolidColorBrush(Colors.DarkGray), Height = 1, Width = 450, BorderThickness = new Thickness(0.5) };
Grid.SetRow(border, numRow);
grid.Children.Add(border);
numRow++;
}
foreach (Control control_i in controlsOfAllSections[section_i])
{
grid.RowDefinitions.Add(new RowDefinition() { Height = System.Windows.GridLength.Auto });
Grid.SetRow(control_i, numRow);
numRow++;
grid.Children.Add(control_i);
}
}
PivotItem mypivot_item = new PivotItem() { Header = new TextBlock() { Text = tab_i.name, FontSize = 30, Margin = new Thickness(0, 10, 0, 0) } };
Grid pvtGrid = new Grid();
ScrollViewer sv = new ScrollViewer();
pvtGrid.Children.Add(sv);
sv.Content = grid;
pvt_item.Content = pvtGrid;
mypivot.Items.Add( mypivot_item);
}
}