|
@@ -0,0 +1,72 @@
|
|
|
+using PDF_Office.Helper;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using System.Windows;
|
|
|
+using System.Windows.Controls;
|
|
|
+using System.Windows.Data;
|
|
|
+using System.Windows.Documents;
|
|
|
+using System.Windows.Input;
|
|
|
+using System.Windows.Media;
|
|
|
+using System.Windows.Media.Imaging;
|
|
|
+using System.Windows.Navigation;
|
|
|
+using System.Windows.Shapes;
|
|
|
+
|
|
|
+namespace PDF_Office.CustomControl
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// TextBoxWithClear.xaml 的交互逻辑
|
|
|
+ /// </summary>
|
|
|
+ public partial class TextBoxWithClear : UserControl
|
|
|
+ {
|
|
|
+ public TextBoxWithClear()
|
|
|
+ {
|
|
|
+ InitializeComponent();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public string PlaceHolderText
|
|
|
+ {
|
|
|
+ get { return (string)GetValue(PlaceHolderTextProperty); }
|
|
|
+ set { SetValue(PlaceHolderTextProperty, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Using a DependencyProperty as the backing store for PlaceHolderText. This enables animation, styling, binding, etc...
|
|
|
+ public static readonly DependencyProperty PlaceHolderTextProperty =
|
|
|
+ DependencyProperty.Register("PlaceHolderText", typeof(string), typeof(TextBoxWithClear), new PropertyMetadata(""));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public string Text
|
|
|
+ {
|
|
|
+ get { return (string)GetValue(TextProperty); }
|
|
|
+ set { SetValue(TextProperty, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Using a DependencyProperty as the backing store for Text. This enables animation, styling, binding, etc...
|
|
|
+ public static readonly DependencyProperty TextProperty =
|
|
|
+ DependencyProperty.Register("Text", typeof(string), typeof(TextBoxWithClear), new PropertyMetadata(""));
|
|
|
+
|
|
|
+ public CornerRadius CornerRadius
|
|
|
+ {
|
|
|
+ get { return (CornerRadius)GetValue(CornerRadiusProperty); }
|
|
|
+ set { SetValue(CornerRadiusProperty, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static readonly DependencyProperty CornerRadiusProperty =
|
|
|
+ DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(TextBoxWithClear), new PropertyMetadata(new CornerRadius(4)));
|
|
|
+
|
|
|
+ private void Button_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ this.Text = "";
|
|
|
+ var textbox = CommonHelper.FindVisualChild<TextBoxEx>(this);
|
|
|
+ if(textbox!=null)
|
|
|
+ {
|
|
|
+ textbox.Focus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|