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 AuroraPLC.Views { /// /// Interaction logic for UCPLCBit.xaml /// public partial class UCPLCBit : UserControl { public UCPLCBit() { InitializeComponent(); } private void Filter_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { // Textbox focus 해제... if (sender is AuroraUIComponent.UserControls.UCKeyValueString) { var scope = FocusManager.GetFocusScope((DependencyObject)sender); FocusManager.SetFocusedElement(scope, null); Keyboard.ClearFocus(); } } } private void Filter_LBDown(object sender, MouseButtonEventArgs e) { if (e.ButtonState == MouseButtonState.Pressed) { // Textbox 에 focus 가 있는데, 다른 곳을 클릭한 경우, Textbox focus 해제... if (Keyboard.FocusedElement is System.Windows.Controls.TextBox) { var scope = FocusManager.GetFocusScope((DependencyObject)sender); FocusManager.SetFocusedElement(scope, null); Keyboard.ClearFocus(); } } } } }