상속: System.Windows.Controls.ContentControl
예제 #1
0
 private static Point CalculateTableDefinitionControlCenterPoint(TableDefinitionControl tableDefinitionControl)
 {
     var result = new Point();
     result.X = (int)tableDefinitionControl.ActualWidth / 2;
     result.Y = (int)tableDefinitionControl.ActualHeight/2;
     return result;
 }
 public static void InitializeDragAndDrop(
     TableDefinitionControl tableDefinitionControl,
     Dictionary<TableDefinition, TableDefinitionControl> tableDefinitionControls,
     ObservableCollection<LinkDefinition> linkDefinitions,
     Canvas modelViewerContainer,
     Dictionary<LinkDefinition, Line> linkDefinitionControls)
 {
     new DragAndDropTableDefinitionControl(
         tableDefinitionControl,
         tableDefinitionControls, 
         linkDefinitions, 
         modelViewerContainer,
         linkDefinitionControls);
 }
 private DragAndDropTableDefinitionControl(
     TableDefinitionControl tableDefinitionControl,
     Dictionary<TableDefinition, TableDefinitionControl> tableDefinitionControls,
     ObservableCollection<LinkDefinition> linkDefinitions,
     Canvas modelViewerContainer,
     Dictionary<LinkDefinition, Line> linkDefinitionControls)
 {
     _isInDrag = false;
     _tableDefinitionControls = tableDefinitionControls;
     _linkDefinitions = linkDefinitions;
     _tableDefinitionControl = tableDefinitionControl;
     _modelViewerContainer = modelViewerContainer;
     _linkDefinitionControls = linkDefinitionControls;
     var tableDefinitionHeader = tableDefinitionControl.Template.FindName("PART_TableDefinitionHeader", tableDefinitionControl) as Grid;
     
     tableDefinitionHeader.MouseLeftButtonDown += TableDefinitionControlOnMouseLeftButtonDown;
     tableDefinitionHeader.MouseMove += TableDefinitionControlOnMouseMove;
     tableDefinitionHeader.MouseLeftButtonUp += TableDefinitionControlOnMouseLeftButtonUp;
 }
예제 #4
0
        private static TableDefinitionControl CreateTableDefinitionControl(TableDefinition tableDefinition)
        {
            var control = new TableDefinitionControl
            {
                EntityName = tableDefinition.TableName,
                Properties = new List<PropertyDefinition>()
            };

            if (tableDefinition.ColumnDefinitions != null && tableDefinition.ColumnDefinitions.Any())
            {
                foreach (var columnDefinition in tableDefinition.ColumnDefinitions)
                {
                    var property = new PropertyDefinition
                    {
                        Name = columnDefinition.Name,
                        Type = columnDefinition.Type,
                        IsPrimaryKey = columnDefinition.IsPrimaryKey
                    };

                    control.Properties.Add(property);
                }
            }

            return control;
        }