1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- namespace Compdfkit_Tools.PDFControlUI
- {
- public partial class CPDFSearchInputUI : UserControl
- {
- public event EventHandler<string> SearchEvent;
- public event EventHandler ClearEvent;
- public string SearchKeyWord
- {
- get
- {
- return SearchTextBox.Text;
- }
- set
- {
- SearchTextBox.Text = value;
- }
- }
- public double InputTextBoxWidth
- {
- get
- {
- return SearchTextBox.Width;
- }
- set
- {
- SearchTextBox.Width = value;
- }
- }
- public double InputTextBoxHeight
- {
- get
- {
- return SearchTextBox.Height;
- }
- set
- {
- SearchTextBox.Height = value;
- }
- }
- public CPDFSearchInputUI()
- {
- InitializeComponent();
- }
- private void SearchTextBox_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Enter && string.IsNullOrEmpty(SearchKeyWord)==false)
- {
- SearchEvent?.Invoke(this, SearchKeyWord);
- }
- }
- private void TextClear_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- SearchKeyWord = string.Empty;
- ClearEvent?.Invoke(this,new EventArgs());
- }
- private void SearchBtn_Click(object sender, RoutedEventArgs e)
- {
- if (string.IsNullOrEmpty(SearchKeyWord) == false)
- {
- SearchEvent?.Invoke(this, SearchKeyWord);
- }
- }
- private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
- {
- if (string.IsNullOrEmpty(SearchKeyWord))
- {
- ClearEvent?.Invoke(this, new EventArgs());
- }
- }
- }
- }
|