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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
/*************************************************************************************
Extended WPF Toolkit
Copyright (C) 2007-2013 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Public
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
For more features, controls, and fast professional support,
pick up the Plus Edition at http://xceed.com/wpf_toolkit
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
***********************************************************************************/
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace Xceed.Wpf.Toolkit.Primitives
{
public abstract class InputBase : Control
{
#region Properties
#region AllowTextInput
public static readonly DependencyProperty AllowTextInputProperty = DependencyProperty.Register( "AllowTextInput", typeof( bool ), typeof( InputBase ), new UIPropertyMetadata( true, OnAllowTextInputChanged ) );
public bool AllowTextInput
{
get
{
return ( bool )GetValue( AllowTextInputProperty );
}
set
{
SetValue( AllowTextInputProperty, value );
}
}
private static void OnAllowTextInputChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
{
InputBase inputBase = o as InputBase;
if( inputBase != null )
inputBase.OnAllowTextInputChanged( ( bool )e.OldValue, ( bool )e.NewValue );
}
protected virtual void OnAllowTextInputChanged( bool oldValue, bool newValue )
{
}
#endregion //AllowTextInput
#region CultureInfo
public static readonly DependencyProperty CultureInfoProperty = DependencyProperty.Register( "CultureInfo", typeof( CultureInfo ), typeof( InputBase ), new UIPropertyMetadata( CultureInfo.CurrentCulture, OnCultureInfoChanged ) );
public CultureInfo CultureInfo
{
get
{
return ( CultureInfo )GetValue( CultureInfoProperty );
}
set
{
SetValue( CultureInfoProperty, value );
}
}
private static void OnCultureInfoChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
{
InputBase inputBase = o as InputBase;
if( inputBase != null )
inputBase.OnCultureInfoChanged( ( CultureInfo )e.OldValue, ( CultureInfo )e.NewValue );
}
protected virtual void OnCultureInfoChanged( CultureInfo oldValue, CultureInfo newValue )
{
}
#endregion //CultureInfo
#region IsReadOnly
public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register( "IsReadOnly", typeof( bool ), typeof( InputBase ), new UIPropertyMetadata( false, OnReadOnlyChanged ) );
public bool IsReadOnly
{
get
{
return ( bool )GetValue( IsReadOnlyProperty );
}
set
{
SetValue( IsReadOnlyProperty, value );
}
}
private static void OnReadOnlyChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
{
InputBase inputBase = o as InputBase;
if( inputBase != null )
inputBase.OnReadOnlyChanged( ( bool )e.OldValue, ( bool )e.NewValue );
}
protected virtual void OnReadOnlyChanged( bool oldValue, bool newValue )
{
}
#endregion //IsReadOnly
#region IsUndoEnabled
public static readonly DependencyProperty IsUndoEnabledProperty = DependencyProperty.Register( "IsUndoEnabled", typeof( bool ), typeof( InputBase ), new UIPropertyMetadata( true, OnIsUndoEnabledChanged ) );
public bool IsUndoEnabled
{
get
{
return ( bool )GetValue( IsUndoEnabledProperty );
}
set
{
SetValue( IsUndoEnabledProperty, value );
}
}
private static void OnIsUndoEnabledChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
{
InputBase inputBase = o as InputBase;
if( inputBase != null )
inputBase.OnIsUndoEnabledChanged( ( bool )e.OldValue, ( bool )e.NewValue );
}
protected virtual void OnIsUndoEnabledChanged( bool oldValue, bool newValue )
{
}
#endregion //IsUndoEnabled
#region Text
public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof( string ), typeof( InputBase ), new FrameworkPropertyMetadata( default( String ), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnTextChanged, null, false, UpdateSourceTrigger.LostFocus ) );
public string Text
{
get
{
return ( string )GetValue( TextProperty );
}
set
{
SetValue( TextProperty, value );
}
}
private static void OnTextChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
{
InputBase inputBase = o as InputBase;
if( inputBase != null )
inputBase.OnTextChanged( ( string )e.OldValue, ( string )e.NewValue );
}
protected virtual void OnTextChanged( string oldValue, string newValue )
{
}
#endregion //Text
#region TextAlignment
public static readonly DependencyProperty TextAlignmentProperty = DependencyProperty.Register( "TextAlignment", typeof( TextAlignment ), typeof( InputBase ), new UIPropertyMetadata( TextAlignment.Left ) );
public TextAlignment TextAlignment
{
get
{
return ( TextAlignment )GetValue( TextAlignmentProperty );
}
set
{
SetValue( TextAlignmentProperty, value );
}
}
#endregion //TextAlignment
#region Watermark
public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register( "Watermark", typeof( object ), typeof( InputBase ), new UIPropertyMetadata( null ) );
public object Watermark
{
get
{
return ( object )GetValue( WatermarkProperty );
}
set
{
SetValue( WatermarkProperty, value );
}
}
#endregion //Watermark
#region WatermarkTemplate
public static readonly DependencyProperty WatermarkTemplateProperty = DependencyProperty.Register( "WatermarkTemplate", typeof( DataTemplate ), typeof( InputBase ), new UIPropertyMetadata( null ) );
public DataTemplate WatermarkTemplate
{
get
{
return ( DataTemplate )GetValue( WatermarkTemplateProperty );
}
set
{
SetValue( WatermarkTemplateProperty, value );
}
}
#endregion //WatermarkTemplate
#endregion //Properties
}
}
|