본문 바로가기

WPF6

07. WPF DataGrid Click 위치로 정보 가져오기 using System.Windows; public T GetParentOfType(DependencyObject element) where T : DependencyObject { Type type = typeof(T); if (element == null) return null; DependencyObject parent = VisualTreeHelper.GetParent(element); if (parent == null && ((FrameworkElement)element).Parent is DependencyObject) parent = ((FrameworkElement)element).Parent; if (parent == null) return null; else if (parent.GetT.. 2020. 8. 21.
06. WPF DataGridViewHelper 데이터그리드 정보 가져오는 헬퍼 public static class DataGridViewHelper { public static DataGridCell GetCell(DataGrid dg, int row, int column) { DataGridRow rowContainer = GetRow(dg, row); if (rowContainer != null) { DataGridCellsPresenter presenter = GetVisualChild(rowContainer); DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column); // 2020. 8. 21.
04. WPF MVVM(3) RelayCommand 2020/08/21 - [WPF] - 02. WPF MVVM(1) View-ViewModel 연결 2020/08/21 - [WPF] - 03. WPF MVVM(2) INotifyPropertyChanged View에서 일어나는 이벤트 가져오기 메뉴가 선택하면 다음과 같은 이벤트가 실행된다 해보자. ViewModel에 다음과 같이 설정한다. BasicsButtonCommand 이름에 주목하자. public AllotmentView ViewWindow { get; set; } public DataTable Grade1Grid { get { return grade1Grid; } set { grade1Grid = value; OnPropertyChanged(); } } public DataRowView Grad.. 2020. 8. 21.
03. WPF MVVM(2) INotifyPropertyChanged 2020/08/21 - [WPF] - 02. WPF MVVM(1) View-ViewModel 연결 public class AllotmentViewModel : PropertyChangedBase { public AllotmentView ViewWindow { get; set; } public DataTable Grade1Grid { get { return grade1Grid; } set { grade1Grid = value; OnPropertyChanged(); } } public DataRowView GradeRowView { set { GradeGrideClick(value); OnPropertyChanged(); } } } public class PropertyChangedBase : INotify.. 2020. 8. 21.