Represents a single parameter.
Inheritance: Open.Core.Common.ModelBase
        private static ComboBoxViewModel CreateComboBox(ViewTestParameter parameter)
        {
            // Setup initial conditions.
            var viewModel = new ComboBoxViewModel
                                {
                                    ToolTip = string.Format("Parameter: {0}", parameter.Info.Name)
                                };

            // Populate with values.
            if (parameter.Type.IsEnum)
            {
                PopulateEnumDropdown(viewModel, parameter);
            }
            else if (parameter.Type.IsA(typeof(bool)))
            {
                PopulateBooleanDropdown(viewModel, parameter);
            }

            // Wire up events.
            Action syncParameterValue = () => { parameter.Value = viewModel.SelectedItemValue; };
            viewModel.SelectionChanged += delegate { syncParameterValue(); };

            // Finish up.
            syncParameterValue();
            return viewModel;
        }
 private static void PopulateEnumDropdown(ComboBoxViewModel viewModel, ViewTestParameter parameter)
 {
     foreach (var value in parameter.Type.GetEnumValues())
     {
         viewModel.Add(value.ToString(), value);
     }
     SelectDefaultValue(viewModel, parameter.Info.DefaultValue);
 }
        private static void PopulateBooleanDropdown(ComboBoxViewModel viewModel, ViewTestParameter parameter)
        {
            var name = parameter.Info.Name;
            viewModel.Add(string.Format("{0}: True", name), true);
            viewModel.Add(string.Format("{0}: False", name), false);

            var defaultValue = parameter.Info.DefaultValue;
            SelectDefaultValue(
                            viewModel,
                            defaultValue is DBNull ? false : defaultValue);
        }