コード例 #1
0
        public UIComponent(FWControl fwControl)
        {
            InitializeComponent();

            Rectangle content = new Rectangle
            {
                Fill    = Brushes.Thistle,
                Opacity = 0.5
            };

            controlText.DataContext = fwControl;

            //최소값 최대값 설정 확인
            minWidth  = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
            maxWidth  = content.MaxWidth;
            maxHeight = content.MaxHeight;

            CanHResize = true;
            CanVResize = true;

            SetComponentSize(fwControl);
            SetComponentPosition(fwControl);

            this.Content   = content;
            this.FWControl = fwControl;

            fwControl.PropertyChanged += FwControl_PropertyChanged;
        }
コード例 #2
0
        /// <summary>
        /// Creates the framework control.
        /// </summary>
        /// <param name="context">Contains information associated with the current HTML tag.</param>
        /// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
        /// <returns>The control instance.</returns>
        protected override IFWHtmlElement RenderControl(TagHelperContext context, TagHelperOutput output)
        {
            if (!FWReflectionHelper.IsCollection(For.Metadata.ModelType))
            {
                throw new FWInvalidModelException("Invalid model for detail. Must use a collection.");
            }

            FWControl control = null;

            switch (Type)
            {
            case FWDetailType.Table:
                control = new FWDetailTableControl(RequestContext, For.Model as IEnumerable, For.Metadata);
                control.Attributes.Add("data-detailtype", "table");
                break;

            case FWDetailType.Grid:
                control = new FWDetailGridControl(RequestContext, For.Model as IEnumerable, For.Metadata);
                control.Attributes.Add("data-detailtype", "grid");
                break;
            }

            control.Attributes.Add("data-control", "detail");

            return(control);
        }
コード例 #3
0
        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                Type type = UIManager.Instance.FlowerToolBox.SelectedFWControl;

                if (type != null)
                {
                    UIComponent uIComponent = null;
                    Point       point       = e.GetPosition(this);
                    FWControl   fwControl   = null;

                    if (type.Equals(typeof(Control.FWButton)))
                    {
                        fwControl = new FWButton
                        {
                            Text = "Button",
                        };
                    }
                    else if (type.Equals(typeof(Control.FWTextBox)))
                    {
                        fwControl = new FWTextBox
                        {
                            Text = "TextBox",
                        };
                    }
                    else if (type.Equals(typeof(Control.FWListBox)))
                    {
                        fwControl = new FWListBox();
                    }

                    fwControl.Left   = point.X;
                    fwControl.Top    = point.Y;
                    fwControl.Width  = 100;
                    fwControl.Height = 30;

                    FWControlList.Add(fwControl);

                    uIComponent = new UIComponent(fwControl);
                    uIComponent.PropertyChanged += UIComponent_PropertyChanged;

                    canvasArea.Children.Add(uIComponent);

                    UIManager.Instance.FlowerToolBox.Deselection();

                    ConvertToData();
                }
            }

            e.Handled = true;
        }
コード例 #4
0
        public void DeleteControl(UIComponent uiComponent)
        {
            FWControl fwControl = uiComponent.FWControl;

            FWEventList fwEventList = fwControl.FWEventList;

            foreach (Event ev in fwEventList.Events)
            {
                if (!string.IsNullOrWhiteSpace(ev.EventValue))
                {
                    //제거.
                }
            }

            FWControlList.Remove(fwControl);
            canvasArea.Children.Remove(uiComponent);
        }
コード例 #5
0
 private void SetComponentSize(FWControl fwControl)
 {
     this.Width  = fwControl.Width;
     this.Height = fwControl.Height;
 }
コード例 #6
0
 private void SetComponentPosition(FWControl fwControl)
 {
     SetValue(Canvas.TopProperty, fwControl.Top);
     SetValue(Canvas.LeftProperty, fwControl.Left);
 }