blob: 3845ae4ed2adeef89bdfebacd3734c045e9c2ed7 (
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
using System;
using System.Windows.Input;
using Microsoft.Phone.Controls;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.WinPhone
{
public class TextCellRenderer : ICellRenderer
{
public virtual System.Windows.DataTemplate GetTemplate(Cell cell)
{
if (cell.RealParent is ListView)
{
if (cell.GetIsGroupHeader<ItemsView<Cell>, Cell>())
return (System.Windows.DataTemplate)System.Windows.Application.Current.Resources["ListViewHeaderTextCell"];
return (System.Windows.DataTemplate)System.Windows.Application.Current.Resources["ListViewTextCell"];
}
return (System.Windows.DataTemplate)System.Windows.Application.Current.Resources["TextCell"];
}
}
public class EntryCellRendererCompleted : ICommand
{
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
public void Execute(object parameter)
{
var entryCell = (IEntryCellController)parameter;
entryCell.SendCompleted();
}
protected virtual void OnCanExecuteChanged()
{
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
}
public class EntryCellPhoneTextBox : PhoneTextBox
{
public event EventHandler KeyboardReturnPressed;
protected override void OnKeyUp(KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
EventHandler handler = KeyboardReturnPressed;
if (handler != null)
handler(this, EventArgs.Empty);
}
base.OnKeyUp(e);
}
}
public class EntryCellRenderer : ICellRenderer
{
public virtual System.Windows.DataTemplate GetTemplate(Cell cell)
{
return (System.Windows.DataTemplate)System.Windows.Application.Current.Resources["EntryCell"];
}
}
public class ViewCellRenderer : ICellRenderer
{
public virtual System.Windows.DataTemplate GetTemplate(Cell cell)
{
return (System.Windows.DataTemplate)System.Windows.Application.Current.Resources["ViewCell"];
}
}
public class SwitchCellRenderer : ICellRenderer
{
public virtual System.Windows.DataTemplate GetTemplate(Cell cell)
{
return (System.Windows.DataTemplate)System.Windows.Application.Current.Resources["SwitchCell"];
}
}
public class ImageCellRenderer : ICellRenderer
{
public virtual System.Windows.DataTemplate GetTemplate(Cell cell)
{
if (cell.RealParent is ListView)
return (System.Windows.DataTemplate)System.Windows.Application.Current.Resources["ListImageCell"];
return (System.Windows.DataTemplate)System.Windows.Application.Current.Resources["ImageCell"];
}
}
}
|