private void InitializeDataGrid() { this.dataGridFavorites.AutoGenerateColumns = false; // because of designer this.bsFavorites.DataSource = ConvertFavoritesToViewModel(PersistedFavorites.ToListOrderedByDefaultSorting()); var sortingProperty = new FavoriteSorting().GetDefaultSortPropertyName(); var sortedColumn = this.dataGridFavorites.FindColumnByPropertyName(sortingProperty); sortedColumn.HeaderCell.SortGlyphDirection = SortOrder.Ascending; this.dataGridFavorites.DataSource = this.bsFavorites; }
/// <summary> /// Returns text compare to method values selecting property to compare /// depending on Settings default sort property value /// </summary> /// <param name="target">not null favorite to compare with</param> /// <returns>result of CompareTo method</returns> internal int CompareByDefaultFavoriteSorting(IFavorite target) { var sorting = new FavoriteSorting(); return(sorting.CompareByDefaultSorting(this.Favorite, target)); }