Example #1
0
        private void UserControl_Drop(object sender, DragEventArgs e)
        {
            Point          point    = e.GetPosition(_sheetController.State.OverlaySheet.GetParent() as FrameworkElement);
            ImmutablePoint position = new ImmutablePoint(point.X, point.Y);

            if (e.Data.GetDataPresent(BlockDropFormat))
            {
                var blockItem = e.Data.GetData(BlockDropFormat) as BlockItem;
                if (blockItem != null)
                {
                    _sheetController.Insert(blockItem, position, true);
                    e.Handled = true;
                }
            }
            else if (e.Data.GetDataPresent(DataDropFormat))
            {
                var dataItem = e.Data.GetData(DataDropFormat) as DataItem;
                if (dataItem != null)
                {
                    _sheetController.TryToBindData(position, dataItem);
                    e.Handled = true;
                }
            }
        }