private void PrepareListOfItems(ObservableCollection <Service.PartsSelectionTreeElement> elements, ElementTypes elementType) { foreach (var element in elements) { var item = new PartsSelectionTreeElement <ElementTypes>(element.Id, element.ElementId, elementType, element.Name, element.Indent); _pageData.SelectionParts.Add(item); } }
private void CreateButtonBlock(PartsSelectionTreeElement <ElementTypes> element) { Button button = new Button(); if (element.Selected) { button.Background = new SolidColorBrush(Colors.DodgerBlue); } else { button.Background = new SolidColorBrush(Colors.WhiteSmoke); } button.Name = element.Id; button.Margin = new Thickness(element.Indent * 20, 5, 0, 5); button.Content = element.Name; ToolTip toolTip = new ToolTip(); toolTip.Content = element.Name; ToolTipService.SetToolTip(button, toolTip); if ((string)comboBox.SelectedItem != null) { var comboItem = Data_Structures.ComboBoxItem.GetComboBoxItemByName(_pageData.ComboItems, (string)comboBox.SelectedItem); if (element.CheckIfCanBeSelected(Data_Structures.ComboBoxItem.GetComboBoxItemByName(_pageData.ComboItems, (string)comboItem.Name).Name) && comboItem.Id != WordPartsPageData.AllItemsId) { button.Tapped += Button_Tapped; } else { button.Background = new SolidColorBrush(Colors.DimGray); } } else { button.Background = new SolidColorBrush(Colors.DimGray); } WordSelectPartsItems.Items.Add(button); }