private void CreatePageContent(MetroTabItem tab, List <Tuple <string, string> > buttons = null) { Grid parentGrid = new Grid(); ColumnDefinition col1 = new ColumnDefinition(); col1.Width = new GridLength(1, GridUnitType.Star); parentGrid.ColumnDefinitions.Add(col1); ColumnDefinition col2 = new ColumnDefinition(); col2.Width = new GridLength(1, GridUnitType.Star); parentGrid.ColumnDefinitions.Add(col2); RowDefinition row; for (int i = 0; i < 5; ++i) { row = new RowDefinition(); row.Height = new GridLength(1, GridUnitType.Star); parentGrid.RowDefinitions.Add(row); // sound button SoundButton soundButton = new SoundButton(); Grid.SetColumn(soundButton, 0); Grid.SetRow(soundButton, i); parentGrid.Children.Add(soundButton); if (buttons != null) { soundButton.SetFile(buttons[i].Item2, buttons[i].Item1); } // menu button MenuButton menuButton = new MenuButton(soundButton); Grid.SetColumn(menuButton, 0); Grid.SetRow(menuButton, i); parentGrid.Children.Add(menuButton); // progress bar SoundProgressBar progressBar = new SoundProgressBar(); Grid.SetColumn(progressBar, 0); Grid.SetRow(progressBar, i); parentGrid.Children.Add(progressBar); soundButton.SetSoundProgressBar(progressBar); } for (int i = 0; i < 5; ++i) { // only have to add the rows once (above) // sound button SoundButton soundButton = new SoundButton(); Grid.SetColumn(soundButton, 1); Grid.SetRow(soundButton, i); parentGrid.Children.Add(soundButton); if (buttons != null) { soundButton.SetFile(buttons[i + 5].Item2, buttons[i + 5].Item1); } // menu button MenuButton menuButton = new MenuButton(soundButton); Grid.SetColumn(menuButton, 1); Grid.SetRow(menuButton, i); parentGrid.Children.Add(menuButton); // progress bar SoundProgressBar progressBar = new SoundProgressBar(); Grid.SetColumn(progressBar, 1); Grid.SetRow(progressBar, i); parentGrid.Children.Add(progressBar); soundButton.SetSoundProgressBar(progressBar); } tab.Content = parentGrid; }
public void SetSoundProgressBar(SoundProgressBar _soundProgressBar) { soundProgressBar = _soundProgressBar; }