public void CreateComboBoxTest() { string name = "TestName"; string style = string.Empty; ComboBox expected = new ComboBox { Name = name, Margin = new Thickness(0, 0, 0, 0), Style = new Style() }; ComboBox actual; actual = InterfaceHelpers.CreateComboBox(name, style); Assert.IsTrue(actual.Name == expected.Name && actual.Margin == expected.Margin); }
//Constructor public EventDimensionSelector(int axis) { _axis = axis; // Create basic DimensionSelectorGrid with four columns DimensionSelectorGrid = new Grid { Name = "dimensionSelectorGrid" + axis }; var col1 = new ColumnDefinition { Width = new GridLength(Column1Width) }; var col2 = new ColumnDefinition { Width = new GridLength(Column2Width) }; var col3 = new ColumnDefinition { Width = new GridLength(Column3Width) }; var col4 = new ColumnDefinition { Width = new GridLength(Column4Width) }; DimensionSelectorGrid.ColumnDefinitions.Add(col1); DimensionSelectorGrid.ColumnDefinitions.Add(col2); DimensionSelectorGrid.ColumnDefinitions.Add(col3); DimensionSelectorGrid.ColumnDefinitions.Add(col4); // Number on the left DimensionSelectorGrid.Children.Add(InterfaceHelpers.CreateTextBlock(axis + "", "Title", gridColumn: 0)); // Create Dimension, Level and Aggregation combo boxes on the middle var panelMiddle = new StackPanel(); panelMiddle.SetValue(Grid.ColumnProperty, 1); panelMiddle.HorizontalAlignment = HorizontalAlignment.Left; panelMiddle.VerticalAlignment = VerticalAlignment.Top; panelMiddle.Children.Add(InterfaceHelpers.CreateLabel("Dimension")); _dimensionComboBox = InterfaceHelpers.CreateComboBox("axis" + axis + "_selector", width: ComboBoxWidth); panelMiddle.Children.Add(_dimensionComboBox); panelMiddle.Children.Add(InterfaceHelpers.CreateLabel("Level", top: LabelTopMargin)); _dimensionLevelComboBox = InterfaceHelpers.CreateComboBox("level" + axis + "_selector", width: ComboBoxWidth); panelMiddle.Children.Add(_dimensionLevelComboBox); panelMiddle.Children.Add(InterfaceHelpers.CreateLabel("Aggregation", top: LabelTopMargin)); _dimensionAggregationComboBox = InterfaceHelpers.CreateComboBox("aggregation" + axis + "_selector", width: ComboBoxWidth); panelMiddle.Children.Add(_dimensionAggregationComboBox); DimensionSelectorGrid.Children.Add(panelMiddle); // Filters on the right var panelRight = new StackPanel(); panelRight.SetValue(Grid.ColumnProperty, 3); panelRight.HorizontalAlignment = HorizontalAlignment.Left; panelRight.VerticalAlignment = VerticalAlignment.Top; panelRight.Children.Add(InterfaceHelpers.CreateLabel("Filter")); _dimensionContentSearch = InterfaceHelpers.CreateTextBox("txtSearchAxis" + axis); _dimensionContentSearch.Width = SearchBoxWidth; panelRight.Children.Add(_dimensionContentSearch); // Filterlist _dimensionContentFilter = new ListBox { Name = "filter" + axis + "_selector", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Width = FilterListWidth, Height = FilterListHeight, Style = Application.Current.TryFindResource("ListBox") as Style, ItemContainerStyle = Application.Current.TryFindResource("ListBoxItemWithCheckbox") as Style, SelectionMode = SelectionMode.Extended }; panelRight.Children.Add(_dimensionContentFilter); // Select all / none var selectAllNone = new StackPanel { Orientation = Orientation.Horizontal }; _selectAllButton = InterfaceHelpers.CreateButton("selectAll" + axis, "Select all", "PlainTextButton"); selectAllNone.Children.Add(_selectAllButton); selectAllNone.Children.Add(InterfaceHelpers.CreateLabel("/")); _selectNoneButton = InterfaceHelpers.CreateButton("selectNone" + axis, "none", "PlainTextButton"); selectAllNone.Children.Add(_selectNoneButton); panelRight.Children.Add(selectAllNone); DimensionSelectorGrid.Children.Add(panelRight); }
/// <summary> /// Creates a grid with dimension-, level- and filter-selection to be displayed right of the matrix. /// </summary> /// <param name="number">Number of the dimension (starting from 1)</param> /// <returns>A Grid that should be added to the interface.</returns> /// <author>Jannik Arndt</author> private Grid CreateSelectorGrid(int number) { const double column1Width = 30; const double column2Width = 130; const double column3Width = 10; const double column4Width = 130; const double comboBoxWidth = column2Width - 10; const double searchBoxWidth = column4Width - 10; const double filterListWidth = column4Width - 10; const double filterListHeight = 80; const double labelTopMargin = 8; // Create basic SelectorGrid with four columns var selectorGrid = new Grid { Name = "selectorGrid" + number }; var col1 = new ColumnDefinition { Width = new GridLength(column1Width) }; var col2 = new ColumnDefinition { Width = new GridLength(column2Width) }; var col3 = new ColumnDefinition { Width = new GridLength(column3Width) }; var col4 = new ColumnDefinition { Width = new GridLength(column4Width) }; selectorGrid.ColumnDefinitions.Add(col1); selectorGrid.ColumnDefinitions.Add(col2); selectorGrid.ColumnDefinitions.Add(col3); selectorGrid.ColumnDefinitions.Add(col4); // Number on the left selectorGrid.Children.Add(InterfaceHelpers.CreateTextBlock(number + "", "Title", gridColumn: 0)); // Dimension and Level-Selectors in the middle var panelMiddle = new StackPanel(); panelMiddle.SetValue(Grid.ColumnProperty, 1); panelMiddle.HorizontalAlignment = HorizontalAlignment.Left; panelMiddle.VerticalAlignment = VerticalAlignment.Top; panelMiddle.Children.Add(InterfaceHelpers.CreateLabel("Dimension")); var axisComboBox = InterfaceHelpers.CreateComboBox("axis" + number + "_selector", width: comboBoxWidth); axisComboBox.SelectionChanged += OnDimensionComboBoxSelectionChanged; panelMiddle.Children.Add(axisComboBox); panelMiddle.Children.Add(InterfaceHelpers.CreateLabel("Level", top: labelTopMargin)); var levelComboBox = InterfaceHelpers.CreateComboBox("level" + number + "_selector", width: comboBoxWidth); levelComboBox.SelectionChanged += OnLevelComboBoxSelectionChanged; panelMiddle.Children.Add(levelComboBox); selectorGrid.Children.Add(panelMiddle); // Filters on the right var panelRight = new StackPanel(); panelRight.SetValue(Grid.ColumnProperty, 3); panelRight.HorizontalAlignment = HorizontalAlignment.Left; panelRight.VerticalAlignment = VerticalAlignment.Top; panelRight.Children.Add(InterfaceHelpers.CreateLabel("Filter")); var quickSearchTextBox = InterfaceHelpers.CreateTextBox("txtSearchAxis" + number); quickSearchTextBox.TextChanged += QuickSearch; quickSearchTextBox.Width = searchBoxWidth; panelRight.Children.Add(quickSearchTextBox); // Filterlist var filterListBox = new ListBox { Name = "filter" + number + "_selector", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Width = filterListWidth, Height = filterListHeight, Style = Application.Current.TryFindResource("ListBox") as Style, ItemContainerStyle = Application.Current.TryFindResource("ListBoxItemWithCheckbox") as Style, SelectionMode = SelectionMode.Extended }; filterListBox.SelectionChanged += OnFilterListBoxSelectionChanged; panelRight.Children.Add(filterListBox); // Select all / none var selectAllNone = new StackPanel { Orientation = Orientation.Horizontal }; var selectAllButton = InterfaceHelpers.CreateButton("selectAll" + number, "Select all", "PlainTextButton"); selectAllButton.Click += FilterListBoxSelectAll; selectAllNone.Children.Add(selectAllButton); selectAllNone.Children.Add(InterfaceHelpers.CreateLabel("/")); var selectNoneButton = InterfaceHelpers.CreateButton("selectNone" + number, "none", "PlainTextButton"); selectNoneButton.Click += FilterListBoxSelectNone; selectAllNone.Children.Add(selectNoneButton); panelRight.Children.Add(selectAllNone); selectorGrid.Children.Add(panelRight); _listOfAxisComboBoxes.Add(axisComboBox); _listOfLevelComboBoxes.Add(levelComboBox); _listOfFilterComboBoxes.Add(filterListBox); _listOfSelectAllButtons.Add(selectAllButton); _listOfSelectNoneButtons.Add(selectNoneButton); _listOfQuicksearchTextfields.Add(quickSearchTextBox); _listOfQuicksearchFirstSearch.Add(true); return(selectorGrid); }