Exemple #1
0
        /// <summary>
        /// Creates a MultiSelectCombo control for input type field.
        /// </summary>
        /// <param name="parameterViewModel">DataContext object.</param>
        /// <param name="rowNumber">Row number.</param>
        /// <param name="itemsSource">Control data source.</param>
        /// <returns>Return a MultiSelectCombo control.</returns>
        private static MultipleSelectionControl CreateMultiSelectComboControl(ParameterViewModel parameterViewModel, int rowNumber, IEnumerable itemsSource)
        {
            MultipleSelectionControl multiControls = new MultipleSelectionControl();

            multiControls.DataContext = parameterViewModel;
            multiControls.SetValue(Grid.ColumnProperty, 1);
            multiControls.SetValue(Grid.RowProperty, rowNumber);
            multiControls.Margin = new Thickness(2);
            multiControls.comboxParameter.ItemsSource = itemsSource;
            multiControls.SetBinding(TextBox.ToolTipProperty, new Binding("ToolTip"));

            Binding valueBinding = new Binding("Value");

            valueBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            multiControls.comboxParameter.SetBinding(ComboBox.TextProperty, valueBinding);

            // Add AutomationProperties.AutomationId for Ui Automation test.
            multiControls.SetValue(System.Windows.Automation.AutomationProperties.AutomationIdProperty, string.Format("combox{0}", parameterViewModel.Name));

            multiControls.comboxParameter.SetValue(
                System.Windows.Automation.AutomationProperties.NameProperty,
                parameterViewModel.Name);

            string buttonToolTipAndName = string.Format(
                CultureInfo.CurrentUICulture,
                ShowCommandResources.SelectMultipleValuesForParameterFormat,
                parameterViewModel.Name);

            multiControls.multipleValueButton.SetValue(Button.ToolTipProperty, buttonToolTipAndName);
            multiControls.multipleValueButton.SetValue(
                System.Windows.Automation.AutomationProperties.NameProperty,
                buttonToolTipAndName);

            return(multiControls);
        }
        /// <summary>
        /// Creates a MultiSelectCombo control for input type field
        /// </summary>
        /// <param name="parameterViewModel">DataContext object</param>
        /// <param name="rowNumber">Row number</param>
        /// <param name="itemsSource">Control data source</param>
        /// <returns>Return a MultiSelectCombo control</returns>
        private static MultipleSelectionControl CreateMultiSelectComboControl(ParameterViewModel parameterViewModel, int rowNumber, IEnumerable itemsSource)
        {
            MultipleSelectionControl multiControls = new MultipleSelectionControl();

            multiControls.DataContext = parameterViewModel;
            multiControls.SetValue(Grid.ColumnProperty, 1);
            multiControls.SetValue(Grid.RowProperty, rowNumber);
            multiControls.Margin = new Thickness(2);
            multiControls.comboxParameter.ItemsSource = itemsSource;
            multiControls.SetBinding(TextBox.ToolTipProperty, new Binding("ToolTip"));

            Binding valueBinding = new Binding("Value");
            valueBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            multiControls.comboxParameter.SetBinding(ComboBox.TextProperty, valueBinding);

            // Add AutomationProperties.AutomationId for Ui Automation test.
            multiControls.SetValue(System.Windows.Automation.AutomationProperties.AutomationIdProperty, string.Format("combox{0}", parameterViewModel.Name));

            multiControls.comboxParameter.SetValue(
                System.Windows.Automation.AutomationProperties.NameProperty,
                parameterViewModel.Name);

            string buttonToolTipAndName = String.Format(
                CultureInfo.CurrentUICulture,
                ShowCommandResources.SelectMultipleValuesForParameterFormat,
                parameterViewModel.Name);

            multiControls.multipleValueButton.SetValue(Button.ToolTipProperty, buttonToolTipAndName);
            multiControls.multipleValueButton.SetValue(
                System.Windows.Automation.AutomationProperties.NameProperty,
                buttonToolTipAndName);

            return multiControls;
        }