/
CellHandler.cs
47 lines (41 loc) · 1.22 KB
/
CellHandler.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using sw = System.Windows;
using swc = System.Windows.Controls;
using Eto.Forms;
namespace Eto.Platform.Wpf.Forms.Controls
{
public interface ICellContainerHandler
{
sw.FrameworkElement SetupCell (ICellHandler cell, sw.FrameworkElement defaultContent);
void FormatCell (ICellHandler cell, sw.FrameworkElement element, swc.DataGridCell datacell, object dataItem);
}
public interface ICellHandler : ICell
{
ICellContainerHandler ContainerHandler { get; set; }
swc.DataGridColumn Control { get; }
}
public abstract class CellHandler<T,W> : WidgetHandler<T, W>, ICellHandler
where T: swc.DataGridColumn
where W: Cell
{
public ICellContainerHandler ContainerHandler { get; set; }
swc.DataGridColumn ICellHandler.Control
{
get { return Control; }
}
public void FormatCell (sw.FrameworkElement element, swc.DataGridCell cell, object dataItem)
{
ContainerHandler.FormatCell (this, element, cell, dataItem);
}
public sw.FrameworkElement SetupCell (sw.FrameworkElement defaultContent)
{
if (ContainerHandler != null)
return ContainerHandler.SetupCell (this, defaultContent);
else
return defaultContent;
}
}
}