blob: 1a53f29480ce356d91c0cfe4a2c74e2aeb86006c (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
using System.Windows;
using System.Windows.Controls;
namespace Tango.Hive
{
public class HexList: ListBox
{
static HexList()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(HexList), new FrameworkPropertyMetadata(typeof(HexList)));
}
public bool UseHexItemHasContainer
{
get { return (bool)GetValue(UseHexItemHasContainerProperty); }
set { SetValue(UseHexItemHasContainerProperty, value); }
}
public static readonly DependencyProperty UseHexItemHasContainerProperty =
DependencyProperty.Register("UseHexItemHasContainer", typeof(bool), typeof(HexList), new PropertyMetadata(false));
public static readonly DependencyProperty OrientationProperty = HexGrid.OrientationProperty.AddOwner(typeof (HexList));
public static readonly DependencyProperty RowCountProperty = HexGrid.RowCountProperty.AddOwner(typeof (HexList));
public static readonly DependencyProperty ColumnCountProperty = HexGrid.ColumnCountProperty.AddOwner(typeof (HexList));
public Orientation Orientation
{
get { return (Orientation)GetValue(OrientationProperty); }
set { SetValue(OrientationProperty, value); }
}
public int RowCount
{
get { return (int)GetValue(RowCountProperty); }
set { SetValue(RowCountProperty, value); }
}
public int ColumnCount
{
get { return (int)GetValue(ColumnCountProperty); }
set { SetValue(ColumnCountProperty, value); }
}
protected override bool IsItemItsOwnContainerOverride(object item)
{
return (item is HexItem);
}
protected override DependencyObject GetContainerForItemOverride()
{
if (UseHexItemHasContainer)
{
return new HexItem();
}
else
{
return base.GetContainerForItemOverride();
}
}
}
}
|