public MainWindow() { InitializeComponent(); Icons = new IconButtonsClass(IconButtons.Children, CommunicationTitle, CommunicationDescription, CommunicationModes.Children, (ComboBox)FindResource("App.Title"), (ComboBox)FindResource("App.Description"), (ComboBox)FindResource("App.Modes"), IconsImages.Children); Modes = new ModeButtonsClass(CommunicationModes.Children, Icons); }
public ModeButtonsClass(UIElementCollection modes, IconButtonsClass icons) { Icons = icons; List <TextBlock> titles = new List <TextBlock>(); int button_id = 0; foreach (Panel panel in modes) { foreach (FrameworkElement element in panel.Children) { switch (element.Tag.ToString()) { case "title": titles.Add((TextBlock)element); if (text_color == null) { text_color = ((TextBlock)element).Foreground; } break; case "button": element.Tag = button_id++; if (button_color == null) { button_color = ((TextBlock)element).Foreground; } break; } } } title_blocks = titles.ToArray(); SelectID = -1; }