/// <summary> /// /// </summary> private void SetWaveSequenceBanksGridViews() { if (PcgMemory == null) { return; } GridViewColumnCollection columns = ((GridView)listViewBanks.View).Columns; columns[0].Width = 60; columns[1].Width = 0; columns[1].Header = string.Empty; listViewBanks.Visibility = Visibility.Visible; if (PcgViewModel.SelectedPcgMemory.WaveSequenceBanks.BankCollection.Any(bank => bank.IsSelected)) { listViewBanks.ScrollIntoView( PcgViewModel.SelectedPcgMemory.WaveSequenceBanks.BankCollection.First(bank => bank.IsSelected)); } else if (listViewBanks.SelectedItems.Count > 0) { listViewBanks.ScrollIntoView(listViewBanks.SelectedItems[0]); } _listViewBanksView = CollectionViewSource.GetDefaultView(listViewBanks.ItemsSource); _listViewBanksView.Filter = bank => ((IBank)bank).FilterForUi; HideAllGridViewPatchesColumns(); SetGridViewPatchesColumn(Strings.ID, 80.0); SetGridViewPatchesColumn(Strings.Name, 175.0); }
internal List <ColumnInfo> GetColumnSettings() { GridViewColumnCollection columns = (lstCatalogMods.View as GridView).Columns; if (columns == null) { return(null); } bool hasInvalidColumns = columns.Any(c => { ColumnTranslations.TryGetValue((c.Header as GridViewColumnHeader).Content as string, out string translatedName); return(string.IsNullOrEmpty(translatedName)); }); if (hasInvalidColumns) { return(null); // exit out if can not translate columns correctly (happens if not initialized in Visual Tree yet and switch languages) } List <string> columnsThatAutoResize = new List <string>() { "Name", "Author" }; return(columns.Select(c => new ColumnInfo() { Name = ColumnTranslations[(c.Header as GridViewColumnHeader).Content as string], Width = c.ActualWidth, AutoResize = columnsThatAutoResize.Contains(ColumnTranslations[((c.Header as GridViewColumnHeader).Content as string)]) }).ToList()); }
/// <summary> /// Sizes the last column to fill the remaining space. /// </summary> private void SizeLastColumn() { GridView itemsView = _processListView.View as GridView; if (itemsView == null) { throw new Exception("Expected a GridView so we can resize the columns."); } double widthAvailable = _processListView.ActualWidth; GridViewColumnCollection columns = itemsView.Columns; int index = 0; double widthCount = 0; foreach (GridViewColumn column in columns) { if (index < columns.Count - 1) { widthCount += column.ActualWidth; } else { // Resize the last column to fill the remaining space if // it doesn't make it 0 size double widthRemaining = widthAvailable - widthCount; if (widthRemaining > 0) { column.Width = widthRemaining; } } index++; } }
protected void ReloadFiles() { _colors.Clear(); ISet <string> colors = new HashSet <string>(); foreach (string color in _colorResourceFiles.SelectMany(crd => crd.Colors.Keys)) { colors.Add(color); } int index = 0; foreach (string color in colors.OrderBy(c => c)) { _colors.Add(new ColorRow(this, color, index++)); } GridViewColumnCollection gvcc = ((GridView)ColorsList.View).Columns; for (int i = gvcc.Count; i > _colorResourceFiles.Count + 1; i--) { gvcc.RemoveAt(i - 1); } for (int i = gvcc.Count; i < _colorResourceFiles.Count + 1; i++) { DataTemplate colorTemplate = ColorsList.FindResource("ColorTemplate" + (i - 1)) as DataTemplate; gvcc.Add(new GridViewColumn { Width = 150, Header = _colorResourceFiles[i - 1].ThemeName, CellTemplate = colorTemplate, }); } }
/// <summary> /// Resets all sorting done and removes the arrows from the columns /// </summary> private void resetSorting() { //get the gridview and then the gridviewcolumns GridView tempGridViewClear = (GridView)RouterList.View; GridViewColumnCollection columnsClear = tempGridViewClear.Columns; //reset all gridviewcolumn headers to be without arrows foreach (GridViewColumn columnGridViewClear in columnsClear) { //get header string string tempColumnClear = columnGridViewClear.Header.ToString(); //remove the arrows if (tempColumnClear.Contains("\u25BC")) { tempColumnClear = tempColumnClear.Split(new string[] { " \u25BC" }, StringSplitOptions.None).First(); } else if (columnGridViewClear.Header.ToString().Contains("\u25B2")) { tempColumnClear = tempColumnClear.Split(new string[] { " \u25B2" }, StringSplitOptions.None).First(); } //reset all columns to orginal state columnGridViewClear.Header = tempColumnClear; //reset sorting to ascending this.sortSwitch = false; } }
private static int FindInsertLocation(GridViewColumnCollection currentColumns, List <GridViewColumn> originalColumns, GridViewColumn column) { int insertLocation = IgnoreVisibilityChange; var currentLocation = currentColumns.IndexOf(column); if (currentLocation < 0) { var originalLocation = originalColumns.IndexOf(column); if (originalLocation > 0) { // try to find where to insert based on neighbors if (originalLocation >= (originalColumns.Count - 1)) { // we were the last column, so stay there. insertLocation = -1; } else { insertLocation = originalLocation; } } else if (originalLocation < 0) { throw new InvalidOperationException(); } ////else we were the first column, so stay there } return(insertLocation); }
/// <summary> /// Event listener for when a column is clicked for sorting /// </summary> /// <param name="sender">object which the event came from</param> /// <param name="e">arguments from the event in this case used to get the correct source</param> private void Column_Click(object sender, RoutedEventArgs e) { //clear searches SearchRouters.Clear(); GridViewColumnHeader columnClicked = e.OriginalSource as GridViewColumnHeader; if (columnClicked == null) { return; } // get only name of column sorted string column = columnClicked.ToString().Split(new string[] { ": " }, StringSplitOptions.None).Last(); //get rid of the arrows if needed if (column.Contains("\u25BC")) { column = column.Split(new string[] { " \u25BC" }, StringSplitOptions.None).First(); } else if (column.Contains("\u25B2")) { column = column.Split(new string[] { " \u25B2" }, StringSplitOptions.None).First(); } // see if column is sortable if (sortableColumns.Contains <string>(column)) { // check to see if clicked column is different from last sorted column if (lastSorted != column && lastSorted.Length > 0) { this.resetSorting(); } //update late sorted column field this.lastSorted = column; //find the header for the clicked column by going through same process as above GridViewColumn tempColumn = null; GridView tempGridView = (GridView)RouterList.View; GridViewColumnCollection columns = tempGridView.Columns; foreach (GridViewColumn columnGridView in columns) { if (columnGridView.Header.ToString().Contains(column)) { tempColumn = columnGridView; break; } } //switch sorting order for clicked column if (sortSwitch) { tempColumn.Header = column + " \u25BC"; } else { tempColumn.Header = column + " \u25B2"; } sortSwitch = !sortSwitch; this.sortRouters(); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { string xaml = Settings.Default.SearchColumns; if (!String.IsNullOrEmpty(xaml)) { //listView1.View = XamlReader.Parse(xaml) as GridView; var savedCols = XamlReader.Parse(xaml) as GridViewColumnCollection; GridViewColumnCollection cols = ((GridView)listView1.View).Columns; var theCols = new List <GridViewColumn>(); foreach (GridViewColumn col in savedCols) { theCols.Add(col); } cols.Clear(); savedCols.Clear(); foreach (GridViewColumn col in theCols) { col.HeaderTemplate = listView1.TryFindResource("HeaderTemplateSortNon") as DataTemplate; cols.Add(col); } } AddSortBinding(); }
private static void TrimColumns(GridViewColumnCollection gridViewColumnCollection, int length) { while (gridViewColumnCollection.Count > length) { gridViewColumnCollection.RemoveAt(length); } }
public void FillProductsRadGridView() { if (this.ProductsRadGridView.Rows.Count > 0) { this.ProductsRadGridView.DataSource = null; } this.ProductsRadGridView.DataSource = this._serviceProduct.SpGetAllProducts(); #region Columns of the GridView try { GridViewColumnCollection columns = this.ProductsRadGridView.Columns; //ProductID Column GridViewDataColumn _productIDColumn = columns["ProductID"]; _productIDColumn.IsVisible = false; //ProductCode Column GridViewDataColumn _productCodeColumn = columns["ProductCode"]; _productCodeColumn.HeaderText = "Código"; _productCodeColumn.Width = 150; //ProductName Column GridViewDataColumn _productNameColumn = columns["ProductName"]; _productNameColumn.HeaderText = "Nombre Producto"; _productNameColumn.Width = 350; //CategoryName Column GridViewDataColumn _categoryNameColumn = columns["CategoryName"]; _categoryNameColumn.HeaderText = "CategorÃa"; _categoryNameColumn.Width = 200; //UnitPrice1 Column GridViewDataColumn _unitPrice1Column = columns["UnitPrice1"]; _unitPrice1Column.HeaderText = "Precio 1 RD$"; _unitPrice1Column.FormatString = "{0:C}"; _unitPrice1Column.Width = 200; //ProductCost Column GridViewDataColumn _productCostColumn = columns["ProductCost"]; _productCostColumn.HeaderText = "Costo"; _productCostColumn.FormatString = "{0:C}"; _productCostColumn.Width = 150; //KardexStock Column GridViewDataColumn _kardexStockColumn = columns["Stock"]; _kardexStockColumn.HeaderText = "Existencia"; _kardexStockColumn.FormatString = "{0:0,0.00}"; _kardexStockColumn.Width = 150; //Clear Selection ClearSelectionRadGridView(); } catch (Exception) { } #endregion ClearSelectionRadGridView(); }
// Token: 0x06005E09 RID: 24073 RVA: 0x001A7084 File Offset: 0x001A5284 private static void ColumnsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { GridViewRowPresenterBase gridViewRowPresenterBase = (GridViewRowPresenterBase)d; GridViewColumnCollection gridViewColumnCollection = (GridViewColumnCollection)e.OldValue; if (gridViewColumnCollection != null) { InternalCollectionChangedEventManager.RemoveHandler(gridViewColumnCollection, new EventHandler <NotifyCollectionChangedEventArgs>(gridViewRowPresenterBase.ColumnCollectionChanged)); if (!gridViewColumnCollection.InViewMode && gridViewColumnCollection.Owner == gridViewRowPresenterBase.GetStableAncester()) { gridViewColumnCollection.Owner = null; } } GridViewColumnCollection gridViewColumnCollection2 = (GridViewColumnCollection)e.NewValue; if (gridViewColumnCollection2 != null) { InternalCollectionChangedEventManager.AddHandler(gridViewColumnCollection2, new EventHandler <NotifyCollectionChangedEventArgs>(gridViewRowPresenterBase.ColumnCollectionChanged)); if (!gridViewColumnCollection2.InViewMode && gridViewColumnCollection2.Owner == null) { gridViewColumnCollection2.Owner = gridViewRowPresenterBase.GetStableAncester(); } } gridViewRowPresenterBase.NeedUpdateVisualTree = true; gridViewRowPresenterBase.InvalidateMeasure(); }
private void TextBlock_Loaded(object sender, RoutedEventArgs e) { GridView gridView = lsItems.View as GridView; if (gridView != null && gridView.Columns.Count >= 2) { // Calculate the item’s desired text width and increase the // text column’s width to match the widest text TextBlock tb = (TextBlock)sender; tb.Measure(new Size(Double.MaxValue, Double.MaxValue)); double newWidth = tb.DesiredSize.Width; GridViewColumnCollection columns = gridView.Columns; if (newWidth > columns[1].Width || double.IsNaN(columns[1].Width)) { columns[1].Width = newWidth; } // Remove the text block cell’s content presenter built-in // margin for better-looking spacing ContentPresenter contentPresenter = VisualTreeHelper.GetParent(tb) as ContentPresenter; if (contentPresenter != null) { contentPresenter.Margin = new Thickness(0); } } }
/// <summary> /// /// </summary> /// <param name="columns"></param> /// <param name="names"></param> public static void HideAllExcept(this GridViewColumnCollection columns, params string[] names) { foreach (var column in columns) { column.IsVisible = names.Contains(column.Name); } }
private static void OnEnabledChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { view = obj as UserControl; if (view != null) { bool enabled = (bool)e.NewValue; if (enabled) { ResourceDictionary rd = view.Resources; GridViewColumnCollection gcc = rd["gvcc"] as GridViewColumnCollection; view.Loaded += (sender, e2) => { UpdateListView((GridViewColumnCollection)gcc); }; view.TargetUpdated += (sender, e2) => { UpdateListView((GridViewColumnCollection)gcc); }; view.DataContextChanged += (sender, e2) => { UpdateListView((GridViewColumnCollection)gcc); }; } } }
private static void TrimColumns(GridViewColumnCollection gridViewColumnCollection, int length) { while (gridViewColumnCollection.Count > length) { gridViewColumnCollection.RemoveAt(length); } }
public static void AddRange(this GridViewColumnCollection collection, IEnumerable <GridViewColumn> columns) { foreach (var gridViewColumn in columns) { collection.Add(gridViewColumn); } }
public UTreeListView() { Columns = new GridViewColumnCollection(); OperationColumns = new GridViewColumnCollection(); EditColumns = new GridViewColumnCollection(); EditOperationColumns = new GridViewColumnCollection(); }
public void FillCategoryRadGridView() { if (this.CategoryRadGridView.Rows.Count > 0) { this.CategoryRadGridView.DataSource = null; } this.CategoryRadGridView.DataSource = _serviceCategoryBL.GetAllCategories(); ClearSelectionRadGridView(); GridViewColumnCollection columns = this.CategoryRadGridView.Columns; //CategoryID Column GridViewDataColumn _categoryIDColumn = columns["CategoryID"]; _categoryIDColumn.IsVisible = false; //CategoryCode Column GridViewDataColumn _categoryCodeColumn = columns["CategoryCode"]; _categoryCodeColumn.HeaderText = "Código"; _categoryCodeColumn.Width = 100; //CategoryName Column GridViewDataColumn _categoryNameColumn = columns["CategoryName"]; _categoryNameColumn.HeaderText = "CategorÃa"; _categoryNameColumn.Width = 100; //Description Column GridViewDataColumn _descriptionColumn = columns["Description"]; _descriptionColumn.HeaderText = "Descripción"; _descriptionColumn.Width = 300; }
public void Handle(GridViewColumnCollection gridViewColumns, String key) { this._gridViewColumns = gridViewColumns; this.key = key; Config.LoadingConfig += Config_Loading; Config.SavingConfig += Config_Saving; }
public virtual void DisplayCurrentSortStates() { GridViewColumnCollection columns = GridViewDataControl.Columns; ISet <GridViewBoundColumnBase> unmatchedColumns = new IdentityHashSet <GridViewBoundColumnBase>(); foreach (GridViewBoundColumnBase column in columns) { unmatchedColumns.Add(column); } foreach (AmbethSortDescriptor sortDescriptor in SortDescriptorList) { foreach (GridViewBoundColumnBase column in columns) { if (column.GetDataMemberName() == sortDescriptor.Member) { column.SortingState = SortDescriptorConverter.GetTelerikSortingState(sortDescriptor); unmatchedColumns.Remove(column); break; } } } foreach (GridViewBoundColumnBase unmatchedColumn in unmatchedColumns) { unmatchedColumn.SortingState = SortingState.None; } }
public void SaveColumnSortOrder(GridViewColumnCollection columns) { StringBuilder content = new StringBuilder(); bool first = true; foreach (var column in columns) { var binding = column.DisplayMemberBinding as System.Windows.Data.Binding; if (binding != null) { if (first) { first = false; } else { content.Append(","); } content.Append(binding.Path.Path); } } string propertyName = string.Format("ColumnOrder{0}", ControllerName); Type t = App.Settings.GetType(); PropertyInfo pi = t.GetProperty(propertyName); pi.SetValue(App.Settings, content.ToString(), null); }
public GridViewColumnCollectionModel(GridViewColumnCollection columns) { foreach (var column in columns) { base.Add(new GridViewColumnModel(column)); } }
//0.2 //0.3 public void UpdateCollumnHeader() { GridViewColumnCollection collection = null; if (View is GridView) { collection = (View as GridView).Columns; } else { collection = (View as VirtualWrapPanelView).Columns; } foreach (GridViewColumn col in collection) { ExComparer.SortCriteria colHeader = GetSortPropertyName(col); if (colHeader != RootModel.SortBy) { col.HeaderTemplate = (DataTemplate)this.Resources["NormHeaderTemplate"]; } else if (RootModel.SortDirection == ListSortDirection.Ascending) { col.HeaderTemplate = (DataTemplate)this.Resources["AscHeaderTemplate"]; } else { col.HeaderTemplate = (DataTemplate)this.Resources["DescHeaderTemplate"]; } } }
public void Handle(GridViewColumnCollection gridViewColumns, String key) { this._gridViewColumns = gridViewColumns; this.key = key; Config.Loading += Config_Loading; Config.Saving += Config_Saving; }
public void FillInvoiceDetailsRadGridView() { if (this.InvoiceRadGridView.Rows.Count > 0) { this.InvoiceRadGridView.DataSource = null; } this.InvoiceRadGridView.DataSource = _serviceInvoiceBL.VDisplayAllInvoices(); #region Columns of the GridView //GridViewDataColumn column1 = new GridViewDataColumn("InvoiceID"); try { GridViewColumnCollection columns = this.InvoiceRadGridView.Columns; //InvoiceID Column GridViewDataColumn _InvoiceIDColumn = columns["InvoiceID"]; _InvoiceIDColumn.IsVisible = false; //InvoiceNumber Column GridViewDataColumn _InvoiceNumberColumn = columns["InvoiceNumber"]; _InvoiceNumberColumn.FormatString = "{0:0000}"; _InvoiceNumberColumn.HeaderText = "Código Fáctura"; _InvoiceNumberColumn.TextAlignment = ContentAlignment.MiddleCenter; _InvoiceNumberColumn.Width = 100; //InvoiceDate Column GridViewDataColumn _InvoiceDateColumn = columns["InvoiceDate"]; _InvoiceDateColumn.HeaderText = "Fecha"; _InvoiceDateColumn.FormatString = "{0:MM/dd/yyyy}"; _InvoiceDateColumn.Width = 100; //CompanyName Column GridViewDataColumn _CompanyNameColumn = columns["CompanyName"]; _CompanyNameColumn.HeaderText = "Vendido a:"; _CompanyNameColumn.Width = 400; //TypeOfP Column GridViewDataColumn _TypeOfPColumn = columns["TypeOfP"]; _TypeOfPColumn.HeaderText = "Pago"; _TypeOfPColumn.Width = 200; //Total Column GridViewDataColumn _TotalColumn = columns["Total"]; _TotalColumn.HeaderText = "Total"; _TotalColumn.FormatString = "{0:C}"; _TotalColumn.Width = 150; //Clear Selection ClearSelectionRadGridView(); } catch (Exception) { } #endregion }
public static void LoadState(GridViewColumnCollection columns, ColumnState[] state) { for (int i = 0; i < state.Length; i++) { columns[i].VisibleIndex = state[i].VisibleIndex; columns[i].Visible = state[i].Visible; } }
// Token: 0x06005E14 RID: 24084 RVA: 0x001A7250 File Offset: 0x001A5450 public static void RemoveHandler(GridViewColumnCollection source, EventHandler <NotifyCollectionChangedEventArgs> handler) { if (handler == null) { throw new ArgumentNullException("handler"); } InternalCollectionChangedEventManager.CurrentManager.ProtectedRemoveHandler(source, handler); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { GridViewColumnCollection columns = ((GridView)listView1.View).Columns; _currentSortedColumn = (GridViewColumnHeader)columns[columns.Count - 1].Header; _lastSortDirection = ListSortDirection.Ascending; UpdateColumnHeaderTemplate(_currentSortedColumn, _lastSortDirection); }
/// <summary> /// Hiding all grid viewi patches columns before setting them. /// </summary> private void HideAllGridViewPatchesColumns() { GridViewColumnCollection columns = ((GridView)listViewPatches.View).Columns; foreach (GridViewColumn column in columns) { column.Width = 0.0; } }
public void FillKardexRadGridView() { if (this.ProductsRadGridView.Rows.Count >= 0) { this.ProductsRadGridView.DataSource = null; } //Fill KardexGridView DataSource this.ProductsRadGridView.DataSource = this._serviceProductBL.ProductToSearching(); #region Columns of the GridView try { GridViewColumnCollection columns = this.ProductsRadGridView.Columns; //ProductDetailID Column GridViewDataColumn _productDetailIDColumn = columns["ProductDetailID"]; _productDetailIDColumn.IsVisible = false; //ProductID Column GridViewDataColumn _productIDColumn = columns["ProductID"]; _productIDColumn.IsVisible = false; //ProductCode Column GridViewDataColumn _productCodeColumn = columns["ProductCode"]; _productCodeColumn.HeaderText = "Código"; _productCodeColumn.Width = 100; //ProductName Column GridViewDataColumn _productNameColumn = columns["ProductName"]; _productNameColumn.HeaderText = "Producto"; _productNameColumn.Width = 200; //UnitPrice1 Column GridViewDataColumn _unitPrice1Column = columns["UnitPrice1"]; _unitPrice1Column.IsVisible = false; //UnitPrice2 Column GridViewDataColumn _unitPrice2Column = columns["UnitPrice2"]; _unitPrice2Column.IsVisible = false; //UnitPrice3 Column GridViewDataColumn _unitPrice3Column = columns["UnitPrice3"]; _unitPrice3Column.IsVisible = false; //Stock Column GridViewDataColumn _stock = columns["Stock"]; _stock.IsVisible = false; ClearSelectionRadGridView(); } catch (Exception) { } #endregion }
/// <summary> /// Initializes a new instance of the <see cref="ExtendedGridView"/> class. /// </summary> /// <param name="pResources">The grid view resources.</param> /// <param name="pItemContainerDefaultStyleKey">The default style key of the item container when displayed in this grid.</param> public ExtendedGridView(Resources pResources, object pItemContainerDefaultStyleKey) { this.mResources = new Resources(); this.ShowColumnHeaders = false; this.mGridViewColumnBackup = new GridViewColumnCollection(); this.mItemContainerDefaultStyleKey = pItemContainerDefaultStyleKey; this.Columns.CollectionChanged += this.OnGridViewColumnsCollectionChanged; }
public void FillProductRadGridView() { if (this.InvoiceDetailsRadGridView.Rows.Count >= 0) { this.InvoiceDetailsRadGridView.DataSource = null; this.InvoiceDetailsRadGridView.Rows.Clear(); } this.InvoiceDetailsRadGridView.DataSource = _invoiceDetailGridModel; #region Columns of the GridView try { GridViewColumnCollection columns = this.InvoiceDetailsRadGridView.Columns; //ProductDetailID Column GridViewDataColumn _productDetailIDColumn = columns["ProductDetailID"]; _productDetailIDColumn.IsVisible = false; //ProductID Column GridViewDataColumn _productIDColumn = columns["ProductID"]; _productIDColumn.IsVisible = false; //ProductCode Column GridViewDataColumn _productCodeColumn = columns["ProductCode"]; _productCodeColumn.HeaderText = "Código"; _productCodeColumn.Width = 150; //ProductName Column GridViewDataColumn _productNameColumn = columns["ProductName"]; _productNameColumn.HeaderText = "Producto"; _productNameColumn.Width = 350; //UnitPrice Column GridViewDataColumn _unitPriceColumn = columns["UnitPrice"]; _unitPriceColumn.HeaderText = "Precio por Unidad"; _unitPriceColumn.FormatString = "{0:C}"; _unitPriceColumn.TextAlignment = ContentAlignment.MiddleRight; _unitPriceColumn.Width = 200; //Quantity Column GridViewDataColumn _quantityColumn = columns["Quantity"]; _quantityColumn.HeaderText = "Cantidad"; _quantityColumn.Width = 200; //SubTotal Column GridViewDataColumn _subTotalColumn = columns["SubTotal"]; _subTotalColumn.HeaderText = "SubTotal"; _subTotalColumn.FormatString = "{0:C}"; _subTotalColumn.Width = 150; //Clear Selection ClearSelectionRadGridView(); } catch (Exception) { } #endregion }
public static void UpdateColumn(ListView listView, ColumnInfo[] colInfos) { GridViewColumnCollection columnCol = getColumnCols(listView); if (columnCol != null) { columnCol.Clear(); AddColumn(listView, columnCol, colInfos); } }
public void SaveColumnSortOrder(GridViewColumnCollection columns) { StringBuilder content = new StringBuilder(); bool first = true; foreach(var column in columns) { var binding = column.DisplayMemberBinding as System.Windows.Data.Binding; if( binding != null ) { if (first) first = false; else content.Append(","); content.Append(binding.Path.Path); } } string propertyName = string.Format("ColumnOrder{0}", ControllerName); Type t = App.Settings.GetType(); PropertyInfo pi = t.GetProperty(propertyName); pi.SetValue(App.Settings, content.ToString(), null); }
private void Handle(DependencyObject sender, GridViewColumnCollection columns) { _isCatchedAlready = true; _owner = sender; _columns = columns; NumerizeColumns(); var visibleColumns = GetVisibleColumns(sender); var notifyCollectionChanged = visibleColumns as INotifyCollectionChanged; if (notifyCollectionChanged != null) notifyCollectionChanged.CollectionChanged += (a, b) => Refresh(); Refresh(); }
/// <summary> /// Remove a listener to the given source's event. /// </summary> public static void RemoveListener(GridViewColumnCollection source, IWeakEventListener listener) { if (source == null) throw new ArgumentNullException("source"); if (listener == null) throw new ArgumentNullException("listener"); CurrentManager.ProtectedRemoveListener(source, listener); }
private void CreateMemberTableColumns() { if (MembersTable == null) { _membersTable = new DataTable(Guid.NewGuid().ToString()); _membersTable.TBaseClass = TBaseClass; } _membersTable.Columns.Clear(); foreach (var systemColum in GridColumns) { DataColumn column = new DataColumn { ColumnName = systemColum.ColumnName, Header = systemColum.Header, DataType = typeof(string) }; column.IsReadOnly = true; _membersTable.Columns.Add(column); } MembersTable = _membersTable; Columns = GeneratedColumnsForGrid(); foreach (var column in Columns) { var txt = new TextBlock(); txt.Text = column.Header.ToString(); txt.TextWrapping = TextWrapping.Wrap; column.Header = txt; } }
/// <summary> /// Initialize a new instance of TreeListView. /// </summary> public TreeListView() { Columns = new GridViewColumnCollection(); }
/// <summary> /// The generated columns for grid. /// </summary> /// <returns> /// The <see cref="GridViewColumnCollection"/>. /// </returns> private GridViewColumnCollection GeneratedColumnsForGrid() { if (MembersTable == null) { return null; } var columns = new GridViewColumnCollection(); var collection = new List<GridViewDataColumn>(); DataTemplate ColumnCheckboxSelected = (DataTemplate)Application.Current.Resources["ColumnCheckboxSelected"]; foreach (var dcolumn in MembersTable.Columns) { var gridColumn = new GridViewDataColumn { Header = dcolumn.Header, UniqueName = dcolumn.ColumnName }; DynamicColumn customColumn = GridColumns.FirstOrDefault(d => d.ColumnName == dcolumn.ColumnName); var path = gridColumn.DataMemberBinding.Path.Path; gridColumn.DataMemberBinding = new Binding { Path = new PropertyPath(path), Mode = BindingMode.TwoWay, }; if (customColumn != null && customColumn.IsSelectedColumn && ColumnCheckboxSelected != null) { gridColumn.CellTemplate = ColumnCheckboxSelected; } columns.Add(gridColumn); } return columns; }
internal static void SaveGridColumnsOrder(GridViewColumnCollection cols, string gridName) { try { var sqlList = new List<string>(); var tableName = gridName == "grdNotes" ? "GRD_NOTES_COLUMNS" : "GRD_BACK_COLUMNS"; for (var i = 0; i < cols.Count; i++) { var sb = new StringBuilder(); sb.Append("UPDATE "); sb.Append(tableName); sb.Append(" SET CN_DISPLAY_INDEX = "); sb.Append(i); sb.Append(" WHERE CN_KEY = '"); sb.Append(PNGridViewHelper.GetColumnName(cols[i])); sb.Append("'"); sqlList.Add(sb.ToString()); } ExecuteTransactionForList(sqlList, SettingsConnectionString); } catch (Exception ex) { PNStatic.LogException(ex); } }
private void SetupColumns() { OutlinerDocument document = __Document; __OutlinerTreeColumns = (GridViewColumnCollection)this.FindResource("gvcc"); while (__OutlinerTreeColumns.Count > 0) __OutlinerTreeColumns.RemoveAt(__OutlinerTreeColumns.Count - 1); for (int i = 0; i < document.ColumnDefinitions.Count; i++) AddColumnBinding(document.ColumnDefinitions[i], i); if (document.ColumnDefinitions.OrderOnInit != null) { string[] ids = document.ColumnDefinitions.OrderOnInit.Split(new char[] { ';' }); for (int i = 0; i < ids.Length; i++) { int newViewId = int.Parse(ids[i]); int currentViewId = GetViewColumnId(i); __OutlinerTreeColumns.Move(currentViewId, newViewId); } document.ColumnDefinitions.OrderOnInit = null; } OutlinerTree.HeaderVisible = (document.ColumnDefinitions.Count > 1) ? Visibility.Visible : Visibility.Collapsed; AdjustColumnSizes(); }
/// <summary> /// Remove a handler for the given source's event. /// </summary> public static void RemoveHandler(GridViewColumnCollection source, EventHandler<NotifyCollectionChangedEventArgs> handler) { if (handler == null) throw new ArgumentNullException("handler"); CurrentManager.ProtectedRemoveHandler(source, handler); }
public void SetColumns(GridViewColumnCollection newColumns) { Columns = newColumns; }
public static void SetColumnCollection(System.Windows.DependencyObject element, GridViewColumnCollection collection) { }
/// <summary> /// Writes the attached property GridViewColumnCollection to the given element. /// </summary> /// <param name="element">The element to which to write the GridViewColumnCollection attached property.</param> /// <param name="collection">The collection to set</param> public static void SetColumnCollection(DependencyObject element, GridViewColumnCollection collection) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(ColumnCollectionProperty, collection); }
public static void SetColumns(DependencyObject dependencyObject, GridViewColumnCollection value) { dependencyObject.SetValue(ColumnsProperty, value); }
private void TryReadColumns() { var presenter = VisualTreeAssist.FindChild<GridViewHeaderRowPresenter>(_owner); if (presenter != null) _columns = presenter.Columns; if (_columns != null) { SetOriginalWidths(); _columns.CollectionChanged += (a, b) => Reset(); } }
private int FindIndex(GridViewColumnCollection columns, String id) { int index = -1; for (int i = 0; i < columns.Count; i++) { GridViewColumnEx col = columns[i] as GridViewColumnEx; if (col != null) { if (col.Identifier == id) { return columns.IndexOf(col); } } } return index; }