public void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { Thumb thumb = (Thumb)sender; ConeViewModel myRectangle = (ConeViewModel)thumb.DataContext; // // Update the the position of the rectangle in the view-model. // myRectangle.X += e.HorizontalChange; myRectangle.Y += e.VerticalChange; }
public ViewModel(DataModel d, Canvas c) { DataModel = d; Canvas = c; d.RecalcNeeded += RecalcNeeded; // // todo stub - Populate the view model with some example data. // var r1 = new ConeViewModel(10, 10, 40, 40, Colors.Blue); _cones.Add(r1); var r2 = new ConeViewModel(70, 70, 40, 40, Colors.Green); _cones.Add(r2); var r3 = new ConeViewModel(130, 130, 40, 40, Colors.Purple); _cones.Add(r3); // // Add some connections between cones. // _connections.Add(new ConnectionViewModel(r1, r2)); _connections.Add(new ConnectionViewModel(r2, r3)); ImageBrush = new ImageBrush(new BitmapImage(new Uri(d.ImageFileName))); }
public ConnectionViewModel(ConeViewModel o1, ConeViewModel o2) { _Obj1 = o1; _Obj2 = o2; }