예제 #1
0
        private void AddReportToolItem(ToolsMenuItem toolItem, Point location)
        {
            UIElement toolObject = Activator.CreateInstance(toolItem.ToolType) as UIElement;

            if (toolItem.ToolType == typeof(ReportDataObject) && this.SectionType == SectionTypeEnum.TableData)
            {
                ReportColumnModel column = toolItem.Tag.To <ReportColumnModel>();

                column.DropX = location.X;

                column.DropY = location.Y;

                if (!this.MayAddColumn(column))
                {
                    return;
                }

                toolObject.SetPropertyValue("ColumnModel", column);
            }

            toolObject.SetPropertyValue("Top", location.Y);

            toolObject.SetPropertyValue("Left", location.X);

            this.SetEditControl(toolObject, false);
        }
예제 #2
0
        protected override void OnDrop(DragEventArgs e)
        {
            e.Handled = true;

            if (e.Data.GetDataPresent(DataFormats.StringFormat))
            {
                #region REPORT TOOL ITEM DROPED

                ToolsMenuItem dropedItem = e.Data.GetData(typeof(ToolsMenuItem)) as ToolsMenuItem;

                Point location = e.GetPosition(this);

                this.AddReportToolItem(dropedItem, location);

                #endregion
            }
            else if (e.Data.GetDataPresent(DataFormats.Serializable))
            {
                #region REMOVE MOVE ON CANVAS

                object[] dataValues = (object[])e.Data.GetData(DataFormats.Serializable);

                #endregion
            }

            base.OnDrop(e);
        }