5
// Lluis Sanchez <lluis@xamarin.com>
7
// Copyright (c) 2011 Xamarin Inc
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the "Software"), to deal
11
// in the Software without restriction, including without limitation the rights
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
// copies of the Software, and to permit persons to whom the Software is
14
// furnished to do so, subject to the following conditions:
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31
public class ComboBoxEntry: ComboBox
36
protected new class WidgetBackendHost: ComboBox.WidgetBackendHost
38
protected override void OnBackendCreated ()
40
base.OnBackendCreated ();
41
((IComboBoxEntryBackend)Backend).SetTextColumn (0);
45
public ComboBoxEntry ()
47
entry = new CustomComboTextEntry (Backend.TextEntryBackend);
50
protected override BackendHost CreateBackendHost ()
52
return new WidgetBackendHost ();
55
IComboBoxEntryBackend Backend {
56
get { return (IComboBoxEntryBackend) BackendHost.Backend; }
59
public TextEntry TextEntry {
66
/// Gets or sets the column that contains the text to be shown in the text entry when an item is selected
71
public DataField TextField {
72
get { return textField; }
76
Backend.SetTextColumn (value.Index);
78
Backend.SetTextColumn (0);
83
class CustomComboTextEntry: TextEntry
85
ITextEntryBackend backend;
87
protected new class WidgetBackendHost: TextEntry.WidgetBackendHost
89
protected override IBackend OnCreateBackend ()
91
return ((CustomComboTextEntry)Parent).backend;
95
protected override Xwt.Backends.BackendHost CreateBackendHost ()
97
return new WidgetBackendHost ();
100
public CustomComboTextEntry (ITextEntryBackend backend)
102
this.backend = backend;