예제 #1
0
 private void ShowWidgetsElementCheckBox()
 {
     xWidgetElementCheckBox.Visibility = Visibility.Visible;
     BindingHandler.ActInputValueBinding(xWidgetElementCheckBox, CheckBox.IsCheckedProperty, mAction.GetOrCreateInputParam(Fields.IsWidgetsElement, "false"), new InputValueToBoolConverter());
 }
예제 #2
0
        public Page GetConfigPage(List <ElementConfigControl> configControlsList)
        {
            StackPanel dynamicPanel = new StackPanel {
                Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center
            };

            UserControlsLib.UCComboBox comboBox;
            Label elementLabel;
            Page  dynamicPage = new Page();

            foreach (ElementConfigControl element in configControlsList)
            {
                if (element.ControlType == eElementType.ComboBox)
                {
                    elementLabel = CretateLabel(element);
                    comboBox     = CreateComboBox(element);

                    comboBox.Init(mAction.GetOrCreateInputParam(element.BindedString), isVENeeded: true, context: Context.GetAsContext(mAction.Context));
                    ((Ginger.UserControlsLib.UCComboBox)comboBox).ComboBox.ItemsSource = element.PossibleValues;
                    if (mAction.ElementLocateBy == eLocateBy.POMElement)
                    {
                        ((Ginger.UserControlsLib.UCComboBox)comboBox).ComboBox.SelectedValue = element.DefaultValue;
                        comboBox.ComboBoxObject.Style = this.FindResource("$FlatEditInputComboBoxStyle") as Style;
                    }
                    dynamicPanel.Children.Add(elementLabel);
                    dynamicPanel.Children.Add(comboBox);
                }
                else if (element.ControlType == eElementType.TextBox)
                {
                    elementLabel = CretateLabel(element);
                    UCValueExpression txtBox = CreateTextBox(element);

                    txtBox.Init(Context.GetAsContext(mAction.Context), mAction.GetOrCreateInputParam(element.BindedString), isVENeeded: true);
                    ((Ginger.Actions.UCValueExpression)txtBox).ValueTextBox.Text = element.PossibleValues.ElementAt(0);
                    dynamicPanel.Children.Add(elementLabel);
                    dynamicPanel.Children.Add(txtBox);
                }
                else if (element.ControlType == eElementType.CheckBox)
                {
                    CheckBox dyanamicCheckBox = new CheckBox();
                    dyanamicCheckBox.Content             = element.Title;
                    dyanamicCheckBox.HorizontalAlignment = HorizontalAlignment.Left;
                    dyanamicCheckBox.VerticalAlignment   = VerticalAlignment.Center;
                    dyanamicCheckBox.IsChecked           = false;
                    dyanamicCheckBox.Width  = 100;
                    dyanamicCheckBox.Margin = new Thickness()
                    {
                        Left = 5
                    };

                    if (element.ElementEvent != null)
                    {
                        dyanamicCheckBox.Click += new RoutedEventHandler(element.ElementEvent);
                    }
                    BindingHandler.ActInputValueBinding(dyanamicCheckBox, CheckBox.IsCheckedProperty, mAction.GetOrCreateInputParam(element.BindedString, "false"));
                    dynamicPanel.Children.Add(dyanamicCheckBox);
                }
            }
            dynamicPage.Content = dynamicPanel;
            return(dynamicPage);
        }