일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- CNN
- GitHub
- Lotto
- javascript
- pycharm
- Button
- index
- ipad
- Numpy
- pandas
- mariadb
- SciPy
- DFS
- imread
- GT-S80
- mean
- SPL
- E-P1
- 알고리즘
- LSTM
- Splunk
- pip
- RNN
- Series
- keras
- 삼성소프트웨어멤버십
- synology
- dataframe
- Python
- install
Archives
- Today
- Total
잠토의 잠망경
[WPF] TextBox Enter Key Event 본문
Event
TextBox 입력후 Enter로 조회하고 싶을때 아래와 같이 MVVM 사용하면 된다.
View
<TextBox
Width="120"
Text="{Binding TxtInput, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="KeyDown">
<ei:CallMethodAction MethodName="UIElement_OnKeyDown" TargetObject="{Binding}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
ViewModel
public void UIElement_OnKeyDown(object sender, KeyEventArgs e)
{
//https://stackoverflow.com/questions/3752451/enter-key-pressed-event-handler
if (e.Key == Key.Enter)
{
CommandSearchFunction();
}
}
Comments