public LineControl(BaseRectangleModel baseRectangleModel) { InitializeComponent(); _baseRectangleModel = baseRectangleModel; this.Height = (double)_baseRectangleModel.model.Height / 4; this.Width = (double)_baseRectangleModel.model.Width / 4; Canvas.SetLeft(this, (double)baseRectangleModel.model.Width - this.Width); Canvas.SetTop(this, ((double)baseRectangleModel.model.Height - this.Height) / 2); }
public MovingControl(BaseRectangleModel baseRectangleModel) { InitializeComponent(); clear.Children.Add(baseRectangleModel.shape); BaseRectangleModel = baseRectangleModel; this.Height = (double)BaseRectangleModel.model.Height; this.Width = (double)BaseRectangleModel.model.Width; Canvas.SetLeft(this, (double)BaseRectangleModel.model.Leftpos); Canvas.SetTop(this, (double)BaseRectangleModel.model.Toppos); _lineControl = new ObservableCollection <LineControl>(); _lineControl.CollectionChanged += _lineControl_CollectionChanged; }
public void AddNewRectangle() { Shapes model = new Shapes() { Toppos = 10, Leftpos = -40, Width = 80, Height = 80, }; OveralldbClass.db.Add(model); OveralldbClass.db.SaveChanges(); BaseRectangleModel baseRectangleModel = new BaseRectangleModel(model); movingControls.Add(new MovingControl(baseRectangleModel)); }