Esempio n. 1
0
 protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)
 {
     for (int i = _visuals.Count - 1; i >= 0; i--)
     {
         BlockView b = _visuals[i] as BlockView;
         if (b != null)
         {
             var p = e.GetPosition(this);
             p.Offset(-b.Offset.X, -b.Offset.Y);
             if (b.ContentBounds.Contains(p) && b._model != null)
             {
                 Workspace.This.AddFile(b._model);
             }
         }
     }
     base.OnMouseLeftButtonUp(e);
 }
Esempio n. 2
0
 protected override void OnInitialized(EventArgs e)
 {
     _vm = this.DataContext as ItemViewModel;
     if (_vm != null)
     {
         if (_vm.sizeX <= 0)
         {
             _vm.sizeX = 35;
         }
         this.Width = _vm.sizeX * CellSize;
         if (_vm.sizeY <= 0)
         {
             _vm.sizeY = 20;
         }
         this.Height = _vm.sizeY * CellSize;
         foreach (var ch in _vm.children)
         {
             var ui = new BlockView(this, ch);
         }
     }
     base.OnInitialized(e);
 }