@@ -115,6 +115,9 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
115
115
welcomeWindow . Show ( ) ;
116
116
}
117
117
118
+ // Initialize place holder
119
+ SetupPlaceholderText ( ) ;
120
+
118
121
// Hide window if need
119
122
UpdatePosition ( ) ;
120
123
if ( _settings . HideOnStartup )
@@ -237,6 +240,9 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
237
240
case nameof ( Settings . WindowTop ) :
238
241
Top = _settings . WindowTop ;
239
242
break ;
243
+ case nameof ( Settings . ShowPlaceholder ) :
244
+ SetupPlaceholderText ( ) ;
245
+ break ;
240
246
}
241
247
} ;
242
248
@@ -1028,6 +1034,43 @@ private void QueryTextBox_OnPreviewDragOver(object sender, DragEventArgs e)
1028
1034
1029
1035
#endregion
1030
1036
1037
+ #region Placeholder
1038
+
1039
+ private void SetupPlaceholderText ( )
1040
+ {
1041
+ if ( _settings . ShowPlaceholder )
1042
+ {
1043
+ QueryTextBox . TextChanged += QueryTextBox_TextChanged ;
1044
+ QueryTextSuggestionBox . TextChanged += QueryTextSuggestionBox_TextChanged ;
1045
+ SetPlaceholderText ( ) ;
1046
+ }
1047
+ else
1048
+ {
1049
+ QueryTextBox . TextChanged -= QueryTextBox_TextChanged ;
1050
+ QueryTextSuggestionBox . TextChanged -= QueryTextSuggestionBox_TextChanged ;
1051
+ QueryTextPlaceholderBox . Visibility = Visibility . Collapsed ;
1052
+ }
1053
+ }
1054
+
1055
+ private void QueryTextBox_TextChanged ( object sender , TextChangedEventArgs e )
1056
+ {
1057
+ SetPlaceholderText ( ) ;
1058
+ }
1059
+
1060
+ private void QueryTextSuggestionBox_TextChanged ( object sender , TextChangedEventArgs e )
1061
+ {
1062
+ SetPlaceholderText ( ) ;
1063
+ }
1064
+
1065
+ private void SetPlaceholderText ( )
1066
+ {
1067
+ var queryText = QueryTextBox . Text ;
1068
+ var suggestionText = QueryTextSuggestionBox . Text ;
1069
+ QueryTextPlaceholderBox . Visibility = string . IsNullOrEmpty ( queryText ) && string . IsNullOrEmpty ( suggestionText ) ? Visibility . Visible : Visibility . Collapsed ;
1070
+ }
1071
+
1072
+ #endregion
1073
+
1031
1074
#region IDisposable
1032
1075
1033
1076
protected virtual void Dispose ( bool disposing )
0 commit comments