main
1using System.Collections.Generic;
2using gorilla.commons.utility;
3
4namespace MoMoney.Presentation.Winforms.Helpers
5{
6 public class BindableListBox<TItemToBindTo> : IBindableList<TItemToBindTo>
7 {
8 readonly IListControl<TItemToBindTo> list_control;
9
10 public BindableListBox(IListControl<TItemToBindTo> list_control)
11 {
12 this.list_control = list_control;
13 }
14
15 public void bind_to(IEnumerable<TItemToBindTo> items)
16 {
17 items.each(x => list_control.add_item(x));
18 }
19
20 public TItemToBindTo get_selected_item()
21 {
22 return list_control.get_selected_item();
23 }
24
25 public void set_selected_item(TItemToBindTo item)
26 {
27 list_control.set_selected_item(item);
28 }
29 }
30}