public override void CreateUIElement() { XamTabControl tab = new XamTabControl(); tab.MinHeight = Convert.ToDouble(Input.GetInput("MinHeight", 100)); tab.MinWidth = Convert.ToDouble(Input.GetInput("MinWidth", 400)); tab.MaxHeight = Convert.ToDouble(Input.GetInput("MaxHeight", 500)); tab.MaxWidth = Convert.ToDouble(Input.GetInput("MaxWidth", 1000)); int n = GetControlCount(); for (int i = 0; i < n; i++) { //Get the control IUIControl control = GetControl(i); IUIInput param = control.Input; //Create the tab item TabItemEx item = new TabItemEx(); string defaultTitle = (string)param.GetInput("Description", "Item-" + (i + 1).ToString()); item.Header = (string)param.GetInput("title", defaultTitle); item.Content = control.GetUIElement(); //Add the tab item to the tab control tab.Items.Add(item); } UtilityMethods.SetPanelResources(tab); UIElement = tab; }
public SimpleDialog(Window parent, IDictionary <string, object> properties, IUIControl control) : this(parent, properties) { //IDictionary<string, object> propertiesCopy = new Dictionary<string, object>(properties); //if(propertiesCopy.ContainsKey("title")) simpleDialogContent = control; DialogContent = control.GetUIElement(); }
/// <summary> /// Adds the controls to a <see cref="StackPanel"/> inside a <see cref="ScrollViewer"/>. /// </summary> /// <returns></returns> private UIElement CreateComponentsPanel() { //the stack panel hold the controls StackPanel panel = new StackPanel(); //the stack panel is placed inside a scroll viewer to enable scrolling ScrollViewer scrollViewer = new ScrollViewer(); scrollViewer.Content = panel; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.MaxHeight = Convert.ToDouble(Input.GetInput("MaxHeight", UIConstants.ControlMaxHeight)); scrollViewer.MaxWidth = Convert.ToDouble(Input.GetInput("MaxWidth", UIConstants.ControlMaxWidth)); scrollViewer.MinHeight = Convert.ToDouble(Input.GetInput("MinHeight", UIConstants.ControlMinHeight)); scrollViewer.MinWidth = Convert.ToDouble(Input.GetInput("MinWidth", UIConstants.ControlMinWidth)); //set orientation of the stack panel depending on the input parameter string orientation = (string)Input.GetInput("orientation", "vertical"); panel.Orientation = orientation.Equals("horizontal") ? Orientation.Horizontal : Orientation.Vertical; //add controls in the stack panel int n = GetControlCount(); for (int i = 0; i < n; i++) { IUIControl control = GetControl(i); UIElement u = control.GetUIElement(); (u as FrameworkElement).VerticalAlignment = VerticalAlignment.Center; panel.Children.Add(u); } return(scrollViewer); }
protected Panel CreateContentPane(IList ui) { List <object> controls = new List <object>(); IDictionary map = null; foreach (object obj in ui) { map = obj as IDictionary; map.Add("showBorder", false); controls.Add(CreateGroup(map)); } Dictionary <string, object> parameters = new Dictionary <string, object> { { "id", "properties" }, { "Description", "Properties" }, { "controls", controls } }; IUIControl omega = null; if (controls.Count == 1) { parameters["Description"] = map.Contains("title") ? map["title"] : "Properties"; omega = OmegaFactory.CreateControl("Group", parameters); } else { omega = OmegaFactory.CreateControl("Tab", parameters); } TabbedComponent = omega; Grid panel = new Grid(); panel.Children.Add(omega.GetUIElement()); return(panel); }
/// <summary> /// Creates a stack panel which contains another stack panel to which the radio buttons /// (for which the 'card' is not null) are added. /// </summary> public override void CreateUIElement() { RadioButtons = new List <RadioButton>(); var labels = Options.Keys; Components = new Dictionary <string, UIElement>(); List <string> componentName = new List <string>(); StackPanel panel = new StackPanel(); cardCount = 0; foreach (string label in labels) { if (Options[label] != null) { if (Options[label] is UIElement) { Components.Add(label, (UIElement)Options[label]); } else if (Options[label] is IUIControl) { IUIControl control = (IUIControl)Options[label]; Components.Add(label, control.GetUIElement()); } cardCount++; componentName.Add(label); RadioButton radioButton = new RadioButton(); radioButton.Content = label; panel.Children.Add(radioButton); radioButton.Checked += RadioButton_Checked; radioButton.Unchecked += RadioButton_Unchecked; RadioButtons.Add(radioButton); } } completePanel = new StackPanel(); completePanel.Children.Add(panel); var scrollViewer = new ScrollViewer(); scrollViewer.Content = completePanel; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; UtilityMethods.SetPanelResources(scrollViewer); scrollViewer.MaxHeight = Convert.ToDouble(Input.GetInput("MaxHeight", UIConstants.ControlMaxHeight)); scrollViewer.MaxWidth = Convert.ToDouble(Input.GetInput("MaxWidth", UIConstants.ControlMaxWidth)); scrollViewer.MinHeight = Convert.ToDouble(Input.GetInput("MinHeight", UIConstants.ControlMinHeight)); scrollViewer.MinWidth = Convert.ToDouble(Input.GetInput("MinWidth", UIConstants.ControlMinWidth)); UIElement = scrollViewer; if (Input.HasParameter("Value")) { if (Options[Input.GetInput("Value").ToString()] != null) { Value = Input.GetInput("Value").ToString(); } } else { Value = componentName[0]; } }