private void SortFundDataGridViewAscending() { DataGridViewColumn sortColumn = dgvFunds.Columns[2]; System.ComponentModel.ListSortDirection direction = System.ComponentModel.ListSortDirection.Ascending; dgvFunds.Sort(sortColumn, direction); }
/// <summary> /// DataGridView Sort method. /// If DataSource is DataTable, special sort the source. /// Else normal sort. /// </summary> /// <param name="dataGridViewColumn">The DataGridViewColumn to sort by header click.</param> /// <param name="direction">The desired sort direction.</param> public override void Sort(DataGridViewColumn dataGridViewColumn, System.ComponentModel.ListSortDirection direction) { DataTable table = (DataTable)this.DataSource; if (this.ShouldSortTable(table)) { Action action = () => { this.RemoveSumRow(table); string col = table.Columns[dataGridViewColumn.Index].ColumnName; if (!this.Direction.Contains(col)) { this.ClearOldSort(); } string sort = this.Direction.Contains("ASC") ? "DESC" : "ASC"; this.Direction = string.Format("{0} {1}", col, sort); this.SortRows(table, this.Direction); this.AddSumRow(table); }; this.MakeInternalChanges(action); dataGridViewColumn.HeaderCell.SortGlyphDirection = this.Direction.Contains("ASC") ? SortOrder.Ascending : SortOrder.Descending; } else { table.DefaultView.Sort = string.Empty; base.Sort(dataGridViewColumn, direction); } }
internal void FillCategoriesList(TreeListNode focusedNode) { _dgvCategories.Rows.Clear(); if (!IsAcronymNode(focusedNode)) { return; } VarConfig.AcronymRow acronymRow = focusedNode.Tag as VarConfig.AcronymRow; foreach (VarConfig.CategoryRow categoryRow in acronymRow.GetCategoryRows()) { int index = _dgvCategories.Rows.Add(categoryRow.Value, categoryRow.Description); _dgvCategories.Rows[index].Tag = categoryRow; } _variablesForm.colCategoryValue.Width = _variablesForm.colCategoryValue.GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); _variablesForm.colCategoryDescription.Width = _variablesForm.colCategoryDescription.GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); if (_dgvCategories.SortedColumn == null) { _dgvCategories.Sort(_variablesForm.colCategoryValue, System.ComponentModel.ListSortDirection.Ascending); } else { System.ComponentModel.ListSortDirection sortOrder = System.ComponentModel.ListSortDirection.Ascending; if (_dgvCategories.SortOrder == SortOrder.Descending) { sortOrder = System.ComponentModel.ListSortDirection.Descending; } _dgvCategories.Sort(_dgvCategories.SortedColumn, sortOrder); } }
private void CompleteUpdateAppsTable(System.Data.DataTable table) { string sortColumnName = dgvApplications.SortedColumn.Name; System.ComponentModel.ListSortDirection sortMethod = System.ComponentModel.ListSortDirection.Ascending; if (dgvApplications.SortOrder == SortOrder.Ascending) { sortMethod = System.ComponentModel.ListSortDirection.Ascending; } else if (dgvApplications.SortOrder == SortOrder.Descending) { sortMethod = System.ComponentModel.ListSortDirection.Descending; } int displayedRow = dgvApplications.FirstDisplayedScrollingRowIndex; dgvApplications.AutoGenerateColumns = false; BindingSource bindingSource = new BindingSource(); bindingSource.DataSource = table; dgvApplications.DataSource = bindingSource; dgvApplications.Sort(dgvApplications.Columns[sortColumnName], sortMethod); if (displayedRow != -1 && dgvApplications.Rows.Count > displayedRow) { dgvApplications.FirstDisplayedScrollingRowIndex = displayedRow; } lbDispalyedCount.Text = lbDispalyedCount.Tag.ToString() + dgvApplications.Rows.Count; }
public QueryOrderBySetting( string propertyName , System.ComponentModel.ListSortDirection direction) { this.PropertyName = propertyName; this.Direction = direction; }
/// <summary> /// Get a list of sorted AlphabeticalListOfProducts /// </summary> /// <param name="trans">Transaction to run select within</param> /// <returns>Arraylist of AlphabeticalListOfProducts</returns> public static IList <AlphabeticalListOfProductInfo> GetAlphabeticalListOfProductsSorted(string sortExpression, System.Data.SqlClient.SqlTransaction trans) { if (string.IsNullOrEmpty(sortExpression)) { return(GetAlphabeticalListOfProducts(trans)); } System.ComponentModel.ListSortDirection listSortDirection = System.ComponentModel.ListSortDirection.Ascending; string[] sortExpressionParams = sortExpression.Split(' '); string sortFieldName = sortExpressionParams[0]; if (sortExpressionParams.Length > 1) { string direction = sortExpressionParams[1]; if (direction.ToUpper() == "DESC") { listSortDirection = System.ComponentModel.ListSortDirection.Descending; } } // Run a search against the data store List <AlphabeticalListOfProductInfo> alphabeticalListOfProducts = (List <AlphabeticalListOfProductInfo>)dal.GetAlphabeticalListOfProducts(trans); Model.SortComparer <AlphabeticalListOfProductInfo> comparer = new Model.SortComparer <AlphabeticalListOfProductInfo>(sortFieldName, listSortDirection); alphabeticalListOfProducts.Sort(comparer); return((IList <AlphabeticalListOfProductInfo>)alphabeticalListOfProducts); }
internal void FillCountrySpecificDescriptionList() { _dgvDescriptions.Rows.Clear(); if (_dgvVariables.SelectedRows.Count != 1 || _dgvVariables.SelectedRows[0].Tag == null) { return; } VarConfig.VariableRow variableRow = _dgvVariables.SelectedRows[0].Tag as VarConfig.VariableRow; foreach (VarConfig.CountryLabelRow countryLabel in variableRow.GetCountryLabelRows()) { int index = _dgvDescriptions.Rows.Add(countryLabel.Country, countryLabel.Label); _dgvDescriptions.Rows[index].Tag = countryLabel; } _variablesForm.colCountry.Width = _variablesForm.colCountry.GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); _variablesForm.colCountryDescription.Width = _variablesForm.colCountryDescription.GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); if (_dgvDescriptions.SortedColumn == null) { _dgvDescriptions.Sort(_variablesForm.colCountry, System.ComponentModel.ListSortDirection.Ascending); } else { System.ComponentModel.ListSortDirection sortOrder = System.ComponentModel.ListSortDirection.Ascending; if (_dgvDescriptions.SortOrder == SortOrder.Descending) { sortOrder = System.ComponentModel.ListSortDirection.Descending; } _dgvDescriptions.Sort(_dgvDescriptions.SortedColumn, sortOrder); } }
/// <summary> /// Get a filted list of AlphabeticalListOfProducts /// </summary> /// <param name="fieldName">Database Field to filter on</param> /// <param name="operatorValue">SQL boolean operator (like, =, <, >, <>, >=, <=)</param> /// <param name="fieldValue">Data to search for</param> /// <returns>Arraylist of AlphabeticalListOfProducts</returns> public static IList <AlphabeticalListOfProductInfo> GetAlphabeticalListOfProductsByFilter(string fieldName, string operatorValue, string fieldValue, string sortExpression) { // Return new if the string is empty if (string.IsNullOrEmpty(fieldName) || string.IsNullOrEmpty(operatorValue) || string.IsNullOrEmpty(fieldValue)) { return(GetAlphabeticalListOfProductsSorted(sortExpression)); } if (string.IsNullOrEmpty(sortExpression)) { return(dal.GetAlphabeticalListOfProductsByFilter(fieldName, operatorValue, fieldValue)); } System.ComponentModel.ListSortDirection listSortDirection = System.ComponentModel.ListSortDirection.Ascending; string[] sortExpressionParams = sortExpression.Split(' '); string sortFieldName = sortExpressionParams[0]; if (sortExpressionParams.Length > 1) { string direction = sortExpressionParams[1]; if (direction.ToUpper() == "DESC") { listSortDirection = System.ComponentModel.ListSortDirection.Descending; } } // Run a search against the data store List <AlphabeticalListOfProductInfo> alphabeticalListOfProducts = (List <AlphabeticalListOfProductInfo>)dal.GetAlphabeticalListOfProductsByFilter(fieldName, operatorValue, fieldValue); Model.SortComparer <AlphabeticalListOfProductInfo> comparer = new Model.SortComparer <AlphabeticalListOfProductInfo>(sortFieldName, listSortDirection); alphabeticalListOfProducts.Sort(comparer); return((IList <AlphabeticalListOfProductInfo>)alphabeticalListOfProducts); }
// C#のWPFでCollectionViewを使ってリスト表示をソート - Ararami Studio //https://araramistudio.jimdo.com/2016/10/27/wpf%E3%81%AEcollectionview%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E3%83%AA%E3%82%B9%E3%83%88%E8%A1%A8%E7%A4%BA%E3%82%92%E3%82%BD%E3%83%BC%E3%83%88/ //パレット色ソート public void SortColor(System.ComponentModel.ListSortDirection listSortDirection) { var cv = CollectionViewSource.GetDefaultView(this.Datas); cv.SortDescriptions.Clear(); cv.SortDescriptions.Add(new System.ComponentModel.SortDescription(nameof(MyData.GrayScaleValue), listSortDirection)); }
private void DimensionButton_Click(object sender, RoutedEventArgs e) { bool temp; if (((Button)sender).Equals(DiameterButton)) { temp = false; } else { temp = true; } foreach (Image img in argRoundList[Convert.ToInt32(temp)].Value) { img.Visibility = Visibility.Hidden; } RoundDimensionsListBox.Items.SortDescriptions.Clear(); RoundDimensionsListBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("Velocity", sortRoundValue)); if (sortRoundValue == System.ComponentModel.ListSortDirection.Descending) { sortRoundValue = System.ComponentModel.ListSortDirection.Ascending; argRoundList[Convert.ToInt32(!temp)].Value[0].Visibility = Visibility.Visible; argRoundList[Convert.ToInt32(!temp)].Value[1].Visibility = Visibility.Hidden; } else { sortRoundValue = System.ComponentModel.ListSortDirection.Descending; argRoundList[Convert.ToInt32(!temp)].Value[0].Visibility = Visibility.Hidden; argRoundList[Convert.ToInt32(!temp)].Value[1].Visibility = Visibility.Visible; } }
private void RectagularDimensionButton_Click(object sender, RoutedEventArgs e) { string tempProperty = string.Empty; if (((Button)sender).Equals(WidthButton)) { tempProperty = "Width"; } if (((Button)sender).Equals(HeightButton)) { tempProperty = "Height"; } else if (((Button)sender).Equals(RectangularVelocityButton)) { tempProperty = "Velocity"; } RectangularDimensionsListBox.Items.SortDescriptions.Clear(); foreach (KeyValuePair <Button, List <Image> > kvp in argRectangularList) { if (!((Button)sender).Equals(kvp.Key)) { foreach (Image img in kvp.Value) { img.Visibility = Visibility.Hidden; } } else { if (!previuosClickedButton.Equals((Button)sender)) { kvp.Value[0].Visibility = Visibility.Visible; kvp.Value[1].Visibility = Visibility.Hidden; sortRectangularValue = System.ComponentModel.ListSortDirection.Ascending; } else { if (sortRectangularValue == System.ComponentModel.ListSortDirection.Ascending) { kvp.Value[0].Visibility = Visibility.Hidden; kvp.Value[1].Visibility = Visibility.Visible; sortRectangularValue = System.ComponentModel.ListSortDirection.Descending; } else { kvp.Value[0].Visibility = Visibility.Visible; kvp.Value[1].Visibility = Visibility.Hidden; sortRectangularValue = System.ComponentModel.ListSortDirection.Ascending; } } RectangularDimensionsListBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription(tempProperty, sortRectangularValue)); } } previuosClickedButton = (Button)sender; }
// Скролл после сортировки public override void Sort(DataGridViewColumn dataGridViewColumn, System.ComponentModel.ListSortDirection direction) { int scrl = this.HorizontalScrollBar.Value; int scrlOffset = this.HorizontalScrollingOffset; base.Sort(dataGridViewColumn, direction); this.HorizontalScrollBar.Value = scrl; this.HorizontalScrollingOffset = scrlOffset; }
/// <summary> /// Aplica a ordenação. /// </summary> /// <param name="property"></param> /// <param name="direction"></param> public void ApplySort(System.ComponentModel.PropertyDescriptor property, System.ComponentModel.ListSortDirection direction) { var entries = new Query.SortEntry[] { new Query.SortEntry(new Query.Column(property.Name), direction == System.ComponentModel.ListSortDirection.Descending) }; _queryable.OrderBy(new Query.Sort(entries)); this.Refresh(); }
/// <summary> /// 根据指定的方向排序。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="queryable"></param> /// <param name="propertyName"></param> /// <param name="direction"></param> /// <returns></returns> public static IQueryable <T> OrderByDirection <T>(this IQueryable <T> queryable, string propertyName, System.ComponentModel.ListSortDirection direction) { dynamic keySelector = ExpressionHelper.GetKeySelector <T>(propertyName); if (direction == System.ComponentModel.ListSortDirection.Ascending) { return(Queryable.OrderBy(queryable, keySelector)); } return(Queryable.OrderByDescending(queryable, keySelector)); }
void sort(string sortby, System.ComponentModel.ListSortDirection listSortDirection) { System.ComponentModel.ICollectionView dataView = CollectionViewSource.GetDefaultView(dataGrid.ItemsSource); if (dataView != null) { dataView.SortDescriptions.Clear(); System.ComponentModel.SortDescription sd = new System.ComponentModel.SortDescription(sortby, listSortDirection); dataView.SortDescriptions.Add(sd); dataView.Refresh(); } }
///-------------------------------------------------------------------------------- /// <summary>This method sorts the list by the input lamda expression and direction.</summary> /// /// <param name="sortProperty">The lamda expression to indicate which property to sort by.</param> /// <param name="sortDirection">The direction of the sort: ascending, descending, or random.</param> ///-------------------------------------------------------------------------------- public void Sort <TKey>(Func <T, TKey> sortProperty, System.ComponentModel.ListSortDirection sortDirection) { switch (sortDirection) { case System.ComponentModel.ListSortDirection.Ascending: ApplySort(Items.OrderBy(sortProperty)); break; case System.ComponentModel.ListSortDirection.Descending: ApplySort(Items.OrderByDescending(sortProperty)); break; } }
public void Sort() { if (_dgv.SelectedCells.Count == 0) { return; } DataGridViewColumn column = _dgv.Columns[_dgv.CurrentCell.ColumnIndex]; System.ComponentModel.ListSortDirection sortDirection = (_dgv.SortOrder == SortOrder.Ascending) ? System.ComponentModel.ListSortDirection.Descending : System.ComponentModel.ListSortDirection.Ascending; _dgv.Sort(column, sortDirection); }
private void filterRules() { LogHelper.Debug("Filtering rules..."); try { Predicate <WFPRules::Rule> pred = null; switch (TypeFilter) { case TypeFilterEnum.ACTIVE: pred += activeRulesPredicate; break; case TypeFilterEnum.WFN: pred += WFNRulesPredicate; break; case TypeFilterEnum.WSH: pred += WSHRulesPredicate; break; case TypeFilterEnum.ALL: default: break; } if (Filter.Length > 0) { pred += filteredRulesPredicate; // text filter } //This code is messy, but the WPF DataGrid forgets the sorting when you change the ItemsSource, and you have to restore it in TWO places. System.ComponentModel.SortDescription oldSorting = gridRules.Items.SortDescriptions.FirstOrDefault(); String oldSortingPropertyName = oldSorting.PropertyName ?? gridRules.Columns.FirstOrDefault().Header.ToString(); System.ComponentModel.ListSortDirection oldSortingDirection = oldSorting.Direction; gridRules.ItemsSource = (pred is null ? allRules : allRules.Where(r => pred.GetInvocationList().All(p => ((Predicate <WFPRules::Rule>)p)(r)))).ToList(); gridRules.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription(oldSortingPropertyName, oldSortingDirection)); foreach (var column in gridRules.Columns) { if (column.Header.ToString() == oldSortingPropertyName) { column.SortDirection = oldSortingDirection; } } gridRules.Items.Refresh(); } catch (Exception e) { LogHelper.Error("Unable to filter FW rules", e); } }
private void SortBroadcastingPeers(object sender, EventArgs e) { //Incase it is being called by window for first time initialization then get the nick too if (sender.GetType() == PrimaryWindow.GetType()) { while (nick == "" || nick == "Enter Nick" || (nick.IndexOf(':') != -1) || (nick.IndexOf('<') != -1) || (nick.IndexOf('>') != -1) || nick.Length > 30) { Dialogs.InputNickWindow _dialog = new Dialogs.InputNickWindow(); _dialog.ShowInTaskbar = false; _dialog.Owner = this; if (_dialog.ShowDialog() == true) { nick = _dialog.ResponseText.Trim(); } } WriteToLogbox("Starting Status Broadcasts"); broadcastTimer = new Timer(Broadcast, null, 0, Timeout.Infinite); } GridViewColumnHeader _column = SortHeader; if (listViewSortCol != null) { System.Windows.Documents.AdornerLayer.GetAdornerLayer(listViewSortCol).Remove(listViewSortAdorner); } System.ComponentModel.ListSortDirection newDir = System.ComponentModel.ListSortDirection.Descending; if (listViewSortCol == _column && listViewSortAdorner.Direction == newDir) { newDir = System.ComponentModel.ListSortDirection.Ascending; } listViewSortCol = _column; if (newDir == System.ComponentModel.ListSortDirection.Ascending) { broadcastingPeersList.Sort(Comparers.PeerContainerCompare.CompareAscending); } else { broadcastingPeersList.Sort(Comparers.PeerContainerCompare.CompareDescending); } listViewSortAdorner = new Graphics.Adorners.SortAdorner(listViewSortCol, newDir); System.Windows.Documents.AdornerLayer.GetAdornerLayer(listViewSortCol).Add(listViewSortAdorner); BroadcastingList.ItemsSource = broadcastingPeersList; BroadcastingList.Items.Refresh(); }
public static IOrderedQueryable <TSource> CustomOrderBy <TSource, TKey>(this IQueryable <TSource> source, System.Linq.Expressions.Expression <Func <TSource, TKey> > keySelector, System.ComponentModel.ListSortDirection sortOrder ) { if (sortOrder == System.ComponentModel.ListSortDirection.Ascending) { return(source.OrderBy(keySelector)); } else { return(source.OrderByDescending(keySelector)); } }
/// <summary> /// Sorts a DataGrid according to a column name an a direction /// </summary> /// <param name="datagrid"></param> /// <param name="columnName"></param> /// <param name="direction"></param> public static void SortBy(this DataGrid datagrid, string columnName, System.ComponentModel.ListSortDirection direction) { datagrid.Items.SortDescriptions.Clear(); datagrid.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription(columnName, direction)); foreach (var item in datagrid.Columns) { if ((string)item.Header == columnName) { item.SortDirection = direction; } else { item.SortDirection = null; } } }
public void Sort <TKey>(Func <T, TKey> keySelector, System.ComponentModel.ListSortDirection direction) { switch (direction) { case System.ComponentModel.ListSortDirection.Ascending: { ApplySort(Items.OrderBy(keySelector)); break; } case System.ComponentModel.ListSortDirection.Descending: { ApplySort(Items.OrderByDescending(keySelector)); break; } } }
public AllSuportedSub4() { array[0, 1] = 9; array2[0, 1, 2] = 9; _listDtringArray = new List <string[]>(); var stringArray = new string[] { "Mats", "Robin", "Kinga" }; _listDtringArray.Add(stringArray); stringArray = new string[] { "Oliwia", "Lidia", "Carter" }; _listDtringArray.Add(stringArray); listSortDirection = System.ComponentModel.ListSortDirection.Ascending; listSortDirectionNullable = System.ComponentModel.ListSortDirection.Descending; listSortDirectionNullable2 = null; aStructNullableNull = null; aStructNullable = new AStruct { anInt = 99, aString = "Kinga" }; }
internal void FillVariablesList() { _dgvVariables.SuspendLayout(); //hopefully that enhences speed //store which row is selected and which row is the first displayed for restoring after refilling string selectedRowID = string.Empty; string firstDisplayedRowID = string.Empty; StoreRowStates(ref selectedRowID, ref firstDisplayedRowID); _dgvVariables.Rows.Clear(); Dictionary <string, bool> isCateg = GetVariablesCategState(); foreach (VarConfig.VariableRow variableRow in _varConfigFacade.GetVariables()) { int index = _dgvVariables.Rows.Add(variableRow.Name, IsMonetary(variableRow), IsHHLevel(variableRow), isCateg[variableRow.ID], variableRow.AutoLabel); _dgvVariables.Rows[index].Tag = variableRow; } _variablesForm.colVariableName.Width = _variablesForm.colVariableName.GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); _variablesForm.colMonetary.Width = _variablesForm.colMonetary.GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); _variablesForm.colAutomaticLabel.Width = _variablesForm.colAutomaticLabel.GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); if (_dgvVariables.SortedColumn == null) { _dgvVariables.Sort(_variablesForm.colVariableName, System.ComponentModel.ListSortDirection.Ascending); } else { System.ComponentModel.ListSortDirection sortOrder = System.ComponentModel.ListSortDirection.Ascending; if (_dgvVariables.SortOrder == SortOrder.Descending) { sortOrder = System.ComponentModel.ListSortDirection.Descending; } _dgvVariables.Sort(_dgvVariables.SortedColumn, sortOrder); } _dgvVariables.ResumeLayout(); RestoreRowStates(selectedRowID, firstDisplayedRowID); //restore selected row and first displayed row FillCountrySpecificDescriptionList(); }
public static void ChangeSortMethod <FI, DI, FSI>( this System.Collections.ObjectModel.ObservableCollection <NavigationItemViewModel <FI, DI, FSI> > collection, SortCriteria sortBy, System.ComponentModel.ListSortDirection sortDirection) where FI : FSI where DI : FSI { System.Windows.Data.ListCollectionView dataView = (System.Windows.Data.ListCollectionView) (System.Windows.Data.CollectionViewSource.GetDefaultView(collection)); dataView.SortDescriptions.Clear(); dataView.CustomSort = null; SortDirectionType direction = sortDirection == System.ComponentModel.ListSortDirection.Ascending ? SortDirectionType.sortAssending : SortDirectionType.sortDescending; dataView.CustomSort = new EntryComparer <FI, DI, FSI>(sortBy, direction) { IsFolderFirst = true }; }
protected override void ApplySortCore(System.ComponentModel.PropertyDescriptor prop, System.ComponentModel.ListSortDirection direction) { if (prop.PropertyType.GetInterface("IComparable") == null) { return; } var _List = this.Items as System.Collections.Generic.List <T>; if (_List == null) { m_IsSorted = false; } else { var _Comparer = new PropertyComparer(prop.Name, direction); _List.Sort(_Comparer); m_IsSorted = true; m_SortDirection = direction; m_SortProperty = prop; } OnListChanged(new System.ComponentModel.ListChangedEventArgs(System.ComponentModel.ListChangedType.Reset, -1)); }
private void DuctPage_Loaded(object sender, RoutedEventArgs e) { sortRoundValue = sortRectangularValue = System.ComponentModel.ListSortDirection.Ascending; previuosClickedButton = WidthButton; argRoundList = new List <KeyValuePair <Button, List <Image> > >() { new KeyValuePair <Button, List <Image> >(DiameterButton, new List <Image>() { VelocityUpImage, VelocityDownImage }), new KeyValuePair <Button, List <Image> >(VelocityButton, new List <Image>() { DiameterUpImage, DiameterDownImage }), }; argRectangularList = new List <KeyValuePair <Button, List <Image> > >() { new KeyValuePair <Button, List <Image> >(WidthButton, new List <Image>() { WidthUpImage, WidthDownImage }), new KeyValuePair <Button, List <Image> >(HeightButton, new List <Image>() { HeightUpImage, HeightDownImage }), new KeyValuePair <Button, List <Image> >(RectangularVelocityButton, new List <Image>() { RectangularVelocityUpImage, RectangularVelocityDownImage }), }; RoundDimensionsListBox.IsVisibleChanged += RoundDimensionsListBox_IsVisibleChanged; ElementProfileComboBox.SelectionChanged += ElementProfileComboBox_SelectionChanged; RectangularDimensionsListBox.SelectionChanged += (s, o) => UpdateChartAxesRange(); RoundDimensionsListBox.SelectionChanged += (s, o) => UpdateChartAxesRange(); viewModel.PropertyChanged += (s, o) => UpdateChartAxesRange(); }
void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e) { GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader; System.ComponentModel.ListSortDirection direction; if (headerClicked != null && headerClicked.Role != GridViewColumnHeaderRole.Padding) { if (headerClicked != _lastHeaderClicked) { direction = System.ComponentModel.ListSortDirection.Ascending; } else { if (_lastDirection == System.ComponentModel.ListSortDirection.Ascending) { direction = System.ComponentModel.ListSortDirection.Descending; } else { direction = System.ComponentModel.ListSortDirection.Ascending; } } // see if we have an attached SortPropertyName value string sortBy = (headerClicked.Column.DisplayMemberBinding as Binding).Path.Path; if (string.IsNullOrEmpty(sortBy)) { // otherwise use the column header name sortBy = headerClicked.Column.Header as string; } sort(sortBy, direction); _lastHeaderClicked = headerClicked; _lastDirection = direction; } }
private void TriButton_Click(object sender, RoutedEventArgs e) { Button b = sender as Button; string propertyName = ""; System.ComponentModel.ListSortDirection sortDirection = System.ComponentModel.ListSortDirection.Ascending; switch (b.Name) { case "mButtonTriAlpha": propertyName = "Nom"; sortDirection = System.ComponentModel.ListSortDirection.Ascending; break; case "mButtonTriAhpla": propertyName = "Nom"; sortDirection = System.ComponentModel.ListSortDirection.Descending; break; case "mButtonTriPrix": propertyName = "Prix"; sortDirection = System.ComponentModel.ListSortDirection.Ascending; break; case "mButtonTriXirp": propertyName = "Prix"; sortDirection = System.ComponentModel.ListSortDirection.Descending; break; } ItemsListBox.Items.SortDescriptions.Clear(); ItemsListBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription(propertyName, sortDirection)); ChampsListBox.Items.SortDescriptions.Clear(); ChampsListBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription(propertyName, sortDirection)); BuildListBox.Items.SortDescriptions.Clear(); BuildListBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription(propertyName, sortDirection)); }
private void EnsureOrderByExpression() { if (__orderByExpressionInitialized) return; __orderByExpressionInitialized = true; if (_initialOrderByExpression != null) { __orderByExpression = _initialOrderByExpression; __sortDirection = _initialSortDirection; } else if (UseNaturalSortOrder) { __orderByExpression = null; __sortDirection = System.ComponentModel.ListSortDirection.Ascending; } else { var sortProp = _type.AndParents(c => c.BaseObjectClass).SelectMany(c => c.Properties).Where(p => p.DefaultSortPriority != null).OrderBy(p => p.DefaultSortPriority).FirstOrDefault(); if (sortProp != null) { __orderByExpression = ColumnDisplayModel.FormatDynamicOrderByExpression(sortProp); __sortDirection = System.ComponentModel.ListSortDirection.Ascending; } else { __orderByExpression = null; __sortDirection = System.ComponentModel.ListSortDirection.Ascending; } } }
void System.ComponentModel.IBindingList.ApplySort(System.ComponentModel.PropertyDescriptor property, System.ComponentModel.ListSortDirection direction) { this._blm227059945.ApplySort(property, direction); }
public void Sort(string orderByExpression, System.ComponentModel.ListSortDirection direction) { if (string.IsNullOrEmpty(orderByExpression)) throw new ArgumentNullException("orderByExpression"); __orderByExpressionInitialized = true; __orderByExpression = orderByExpression; __sortDirection = direction; if (_instancesFromServer.Count < Helper.MAXLISTCOUNT) { UpdateFilteredInstances(); } else { Refresh(); } }
public void SetInitialSort(string orderByExpression, System.ComponentModel.ListSortDirection direction) { if (string.IsNullOrEmpty(orderByExpression)) throw new ArgumentNullException("orderByExpression"); __orderByExpressionInitialized = false; _initialOrderByExpression = orderByExpression; _initialSortDirection = direction; }