WPF Combobox 선택 이벤트, old 값이 나올때
Code/C#2019. 3. 19. 16:45
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 31 | private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { DateTime dt = DateTime.Now; string text= (e.AddedItems[0] as ComboBoxItem).Content as string; if(text==null || BottomTextBoxDate==null) { return; } if (text.Equals("이번주")) { dt = DateTime.Today.AddDays(Convert.ToInt32(DayOfWeek.Monday) - Convert.ToInt32(DateTime.Today.DayOfWeek)); BottomTextBoxDate.Text = dt.ToString(); } else if (text.Equals("이번달")) { dt = DateTime.Today.AddDays(1 - DateTime.Today.Day); BottomTextBoxDate.Text = dt.ToString(); } else if (text.Equals("올해")) { dt = DateTime.Today.AddDays(1 - DateTime.Today.Day); dt = dt.AddMonths(1 - DateTime.Today.Month); BottomTextBoxDate.Text = dt.ToString(); } else { } } | cs |
e 매개변수를 사용합시다.
'Code > C#' 카테고리의 다른 글
WPF 배경이 없는 이미지 버튼 만들기(Hover 배경색 변경가능) (0) | 2019.03.28 |
---|---|
WPF ToolTip 기본 컨트롤 스타일 재정의 하는 방법 (0) | 2019.03.28 |
WPF C#으로 UserControll을 바로 다이얼로그 화면으로 출력 하고 싶을때 (0) | 2019.03.12 |
WPF XAML로 다른 클래스 라이브러리에 있는 xaml 참조하는 방법 (0) | 2019.03.12 |
WPF TextBlock에 다중 바인딩으로 글자 표현하는 방법 (0) | 2019.03.11 |