public WebControl(string id, string name, WebControlTypeEnum type, string value, string className) { this.Id = id; this.Name = name; this.Type = type; this.Value = value; this.ClassName = className; }
public WebControl(string id, string name, WebControlTypeEnum type, string value, string className, List <WebControl> childrenControls) { this.Id = id; this.Name = name; this.Type = type; this.Value = value; this.ClassName = className; this._childrenControls = childrenControls; }
public WebControl(WebControlTypeEnum type) { this.Type = type; }
private void ReadControlPropertFromXaml() { SolidColorBrush newBrush; switch (_control.GetType().FullName.Replace("WebSiteArchitect.AdminApp.Controls.Layout.", "").ToLower()) { case "button": _controlType = WebControlTypeEnum.button; _content = ((_control.Content as Grid).Children[0] as Button); newBrush = (SolidColorBrush)((_content as Button).Background); _backgroundColor = newBrush.Color; newBrush = (SolidColorBrush)((_content as Button).Foreground); _fontColor = newBrush.Color; newBrush = (SolidColorBrush)((_content as Button).BorderBrush); _contentColor = newBrush.Color; this.Value = (_content as Button).Content.ToString(); _verticalAlign = (_content as Button).VerticalAlignment; _fontSize = (_content as Button).FontSize; if ((_content as Button).ToolTip != null) { _goTo = (_content as Button).ToolTip.ToString(); } break; case "emptyspace": this._controlType = WebControlTypeEnum.emptySpace; _controlType = WebControlTypeEnum.emptySpace; _content = _control.Content; newBrush = (SolidColorBrush)((_control.Content as Rectangle).Fill); _backgroundColor = newBrush.Color; break; case "input": _controlType = WebControlTypeEnum.input; _content = ((_control.Content as Grid).Children[0] as TextBox); newBrush = (SolidColorBrush)((_content as TextBox).Background); _backgroundColor = newBrush.Color; newBrush = (SolidColorBrush)((_content as TextBox).Foreground); _fontColor = newBrush.Color; newBrush = (SolidColorBrush)((_content as TextBox).BorderBrush); _backgroundColor = newBrush.Color; newBrush = (SolidColorBrush)((_content as TextBox).Background); _contentColor = newBrush.Color; this.Value = (_content as TextBox).Text.ToString(); _verticalAlign = (_content as TextBox).VerticalAlignment; _textAlign = (_content as TextBox).TextAlignment; _fontSize = (_content as TextBox).FontSize; break; case "label": _controlType = WebControlTypeEnum.label; _content = ((_control.Content as Grid).Children[0] as Label).Content; newBrush = (SolidColorBrush)((_control.Content as Grid).Background); _backgroundColor = newBrush.Color; newBrush = (SolidColorBrush)((_content as AccessText).Foreground); _fontColor = newBrush.Color; this.Value = (_content as AccessText).Text.ToString(); _verticalAlign = (_content as AccessText).VerticalAlignment; _textAlign = (_content as AccessText).TextAlignment; _fontSize = (_content as AccessText).FontSize; break; case "panel": _controlType = WebControlTypeEnum.panel; break; case "select": _controlType = WebControlTypeEnum.select; _content = ((_control.Content as Grid).Children[0] as ComboBox); newBrush = (SolidColorBrush)((_content as ComboBox).Background); _backgroundColor = newBrush.Color; newBrush = (SolidColorBrush)((_content as ComboBox).Foreground); _fontColor = newBrush.Color; break; case "row": _controlType = WebControlTypeEnum.row; break; case "image": _controlType = WebControlTypeEnum.image; _content = ((_control.Content as Grid).Children[0] as Image); newBrush = (SolidColorBrush)(_control.Background); if (newBrush != null) { _backgroundColor = newBrush.Color; } _itemAlign = (_content as Image).HorizontalAlignment; _verticalAlign = (_content as Image).VerticalAlignment; this.Value = (_content as Image).Source.ToString(); break; default: _controlType = WebControlTypeEnum.emptySpace; break; } _controlTypeName = _control.GetType().FullName.Replace("WebSiteArchitect.AdminApp.Controls.Layout.", ""); _parentControl = _control.Parent as Grid; if (_parentControl != null) { _childIndex = _parentControl.Children.IndexOf(_control); _size = Convert.ToInt32(_parentControl.ColumnDefinitions[_childIndex].Width.Value); _height = _parentControl.ActualHeight; } }