/// <summary> /// Constructor for Error user control class. /// Creates data source with page size 18. /// </summary> public ErrorLogUserControl() { InitializeComponent(); m_dataContext = new ErrorLogViewModel(18); m_dataContext.PropertyChanged += ViewModel_PropertyChanged; this.DataContext = m_dataContext; m_sortColumn = DataGridList.Columns.Single(column => (string)column.Header == "Sl No."); m_sortMemberPath = "ID"; m_sortDirection = ListSortDirection.Descending; m_dataContext.SortData(m_sortMemberPath, m_sortDirection); }
private void DataGrid_Sorting(object sender, DataGridSortingEventArgs e) { if (e.Column.SortMemberPath != m_sortMemberPath) { m_sortDirection = ListSortDirection.Ascending; } else if (m_sortDirection == ListSortDirection.Ascending) { m_sortDirection = ListSortDirection.Descending; } else { m_sortDirection = ListSortDirection.Ascending; } m_sortColumn = e.Column; m_sortMemberPath = e.Column.SortMemberPath; m_dataContext.SortData(m_sortMemberPath, m_sortDirection); }