Documente Academic
Documente Profesional
Documente Cultură
2 COMMENTS
BY EINAR INGEBRIGTSEN .NET, C#
http://ingebrigtsen.info/2010/08/31/mvvm-in-windows-forms/
1/6
3/10/2014
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
31
32
33
34
35
36
37
The next thing I wanted to accomplish, was the ability to hook up Commands for Buttons and
such, supporting the ICommand interface found in WPF. I came up with a
CommandExtenderProvider:
1
2
3
4
5
6
7
8
9
10
11
12
[ProvideProperty("Command", typeof(Button))]
public class CommandExtenderProvider : Component, IExtenderProvider
{
private readonly Dictionary _buttonsWithCommands;
private readonly List _uninitializedButtons;
public CommandExtenderProvider()
{
_buttonsWithCommands = new Dictionary();
_uninitializedButtons = new List();
}
public bool CanExtend(object extendee)
{
http://ingebrigtsen.info/2010/08/31/mvvm-in-windows-forms/
2/6
3/10/2014
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
http://ingebrigtsen.info/2010/08/31/mvvm-in-windows-forms/
3/6
3/10/2014
67
68
69
70
71
72
}
};
}
}
}
}
In the designer, youll get two new components you can then drag onto your Windows Forms
design surface:
4/6
3/10/2014
Reply
http://ingebrigtsen.info/2010/08/31/mvvm-in-windows-forms/
5/6
3/10/2014
http://ingebrigtsen.info/2010/08/31/mvvm-in-windows-forms/
6/6