-
Notifications
You must be signed in to change notification settings - Fork 1
/
TestView.cs
30 lines (27 loc) · 1.07 KB
/
TestView.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DragDropTwoGrids.ViewModels;
namespace DragDropTwoGrids.View {
public partial class TestView : UserControl {
public TestView() {
InitializeComponent();
DragAndDropHelper helper = new DragAndDropHelper(this.gridControl1);
if(!mvvmContext1.IsDesignMode)
InitBindings(helper);
}
private void InitBindings(DragAndDropHelper helper) {
var fluentAPI = mvvmContext1.OfType<DragDropViewModel>();
fluentAPI.SetBinding(gridControl1, c => c.DataSource, x => x.Files);
fluentAPI.WithEvent<MyDragAndDropEventArgs>(helper, "Drop")
.EventToCommand(x => x.Drop(null), args => args.Record != null);
fluentAPI.WithEvent<MyOnDeleteEventArgs>(helper, "RemoveRecord")
.EventToCommand(x => x.RemoveRecord(null), args => args.Record);
}
}
}