개정판 6b5d33c6
issue #1002 comment 선택 시 control 객체의 focus event 로 인한 문제로 event 호출 위치및 순서를 정리.
Change-Id: Ie8752339ac93bab04e24f94dbc9a61d0db8f93bd
MarkupToPDF/Controls/Text/TextControl.cs | ||
---|---|---|
59 | 59 |
|
60 | 60 |
public TextControl() |
61 | 61 |
{ |
62 |
this.DefaultStyleKey = typeof(TextControl); |
|
62 |
this.DefaultStyleKey = typeof(TextControl);
|
|
63 | 63 |
} |
64 | 64 |
|
65 | 65 |
static TextControl() |
... | ... | |
68 | 68 |
ResourceDictionary dictionary = new ResourceDictionary(); |
69 | 69 |
dictionary.Source = new Uri("/MarkupToPDF;component/Themes/generic.xaml", UriKind.RelativeOrAbsolute); |
70 | 70 |
Application.Current.Resources.MergedDictionaries.Add(dictionary); |
71 |
|
|
71 | 72 |
} |
72 |
|
|
73 |
|
|
74 |
|
|
73 | 75 |
public override void OnApplyTemplate() |
74 | 76 |
{ |
75 |
base.OnApplyTemplate(); |
|
76 |
|
|
77 |
base.OnApplyTemplate(); |
|
77 | 78 |
|
78 | 79 |
Base_TextPath = GetTemplateChild(PART_TextPath) as Path; |
79 | 80 |
Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox; |
... | ... | |
81 | 82 |
Base_Grid = GetTemplateChild(PART_Grid) as Grid; |
82 | 83 |
Base_Border = GetTemplateChild(PART_Border) as Border; |
83 | 84 |
|
84 |
|
|
85 |
//Base_TextPrefixBlock = GetTemplateChild(PART_TextPrefix) as TextBlock; |
|
86 |
|
|
87 |
//Canvas.SetLeft(this, this.StartPoint.X); |
|
88 |
//Canvas.SetTop(this, this.StartPoint.Y); |
|
89 |
|
|
90 |
//CanvasX = StartPoint.X; |
|
91 |
//CanvasY = StartPoint.Y; |
|
92 |
|
|
93 |
//this.LostFocus += new RoutedEventHandler(TextControl_LostFocus); |
|
94 |
//this.GotFocus += new RoutedEventHandler(TextControl_GotFocus); |
|
95 | 85 |
this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged); |
96 |
this.Base_TextBlock.SizeChanged += Base_TextBlock_SizeChanged; |
|
97 |
|
|
98 |
this.Base_TextBox.LostFocus += Base_TextBox_LostFocus; |
|
99 |
//this.MouseDown += TextControl_MouseDown; |
|
100 |
|
|
101 |
|
|
102 |
|
|
86 |
this.Base_TextBlock.SizeChanged += new SizeChangedEventHandler(Base_TextBlock_SizeChanged); |
|
87 |
this.Base_TextBox.GotFocus += new RoutedEventHandler(TextControl_GotFocus); |
|
88 |
this.Base_TextBox.LostFocus += new RoutedEventHandler(TextControl_LostFocus); |
|
89 |
|
|
90 |
DrawingCloud(); |
|
103 | 91 |
SetText(); |
104 |
Base_TextBox.Focus(); |
|
105 |
|
|
106 |
this.Focusable = false; |
|
107 |
if (!String.IsNullOrEmpty(this.Text)) |
|
108 |
{ |
|
109 |
Base_TextBlock.Visibility = Visibility.Visible; |
|
110 |
Base_TextBox.Visibility = Visibility.Collapsed; |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
private void Base_TextBox_LostFocus(object sender, EventArgs e) |
|
115 |
{ |
|
116 |
IsEditing = false; |
|
117 |
UnEditingMode(); |
|
118 |
ApplyOverViewData(); |
|
119 | 92 |
} |
93 |
|
|
120 | 94 |
|
121 | 95 |
public void ApplyOverViewData() |
122 | 96 |
{ |
... | ... | |
211 | 185 |
|
212 | 186 |
public void EditingMode() |
213 | 187 |
{ |
188 |
//this.Base_TextBox.Focus(); |
|
214 | 189 |
//System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString()); |
215 | 190 |
TextBoxVisibility = Visibility.Visible; |
216 | 191 |
//Base_TextBox.Visibility = System.Windows.Visibility.Visible; |
... | ... | |
288 | 263 |
{ |
289 | 264 |
Base_TextPath.StrokeThickness = LineSize.Left; |
290 | 265 |
} |
291 |
|
|
292 |
OverViewPathData = PathData; |
|
293 |
OverViewText = Text; |
|
294 | 266 |
} |
295 | 267 |
|
296 | 268 |
public void DrawingCloud() |
297 | 269 |
{ |
298 | 270 |
this.ApplyTemplate(); |
299 |
|
|
271 |
|
|
300 | 272 |
List<Point> pCloud = new List<Point> |
301 | 273 |
{ |
302 | 274 |
new Point(0, 0), |
... | ... | |
337 | 309 |
} |
338 | 310 |
} |
339 | 311 |
|
340 |
SetText(); |
|
312 |
//SetText();
|
|
341 | 313 |
} |
342 | 314 |
#endregion Internal Method |
343 | 315 |
|
... | ... | |
1136 | 1108 |
if (e.OldValue != e.NewValue && instance.Base_TextBlock != null) |
1137 | 1109 |
{ |
1138 | 1110 |
instance.SetValue(e.Property, e.NewValue); |
1139 |
instance.SetText();
|
|
1111 |
//instance.DrawingCloud();
|
|
1140 | 1112 |
} |
1141 | 1113 |
} |
1142 | 1114 |
|
... | ... | |
1146 | 1118 |
if (e.OldValue != e.NewValue && instance.Base_TextBlock != null) |
1147 | 1119 |
{ |
1148 | 1120 |
instance.SetValue(e.Property, e.NewValue); |
1149 |
instance.SetText();
|
|
1121 |
//instance.DrawingCloud();
|
|
1150 | 1122 |
} |
1151 | 1123 |
} |
1152 | 1124 |
|
... | ... | |
1156 | 1128 |
if (e.OldValue != e.NewValue && instance!= null) |
1157 | 1129 |
{ |
1158 | 1130 |
instance.SetValue(e.Property, e.NewValue); |
1159 |
instance.SetText();
|
|
1131 |
//instance.DrawingCloud();
|
|
1160 | 1132 |
} |
1161 | 1133 |
} |
1162 | 1134 |
|
내보내기 Unified diff