public void SetGridHeader() { int iRow = UltraWebGrid1.Columns.Count; for (int i = iRow; i > 0; i--) { UltraWebGrid1.Columns.RemoveAt(iRow); } UltraWebGrid1.ResetColumns(); DataTable dtCol = this.CODE_TABLE; iRow = dtCol.Rows.Count; UltraGridColumn cn = null; cn = new UltraGridColumn("YY", "년도", ColumnType.NotSet, ""); cn.BaseColumnName = "YY"; cn.Width = Unit.Pixel(120); cn.CellStyle.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid1.Columns.Add(cn); for (int i = 0; i < iRow; i++) { cn = new UltraGridColumn(dtCol.Rows[i][0].ToString(), dtCol.Rows[i][1].ToString(), ColumnType.NotSet, 0); cn.BaseColumnName = dtCol.Rows[i][0].ToString(); cn.Width = Unit.Pixel(165); cn.DataType = "System.Double"; cn.Format = "#,###,###,###,###,###,###,###,###,##0.00"; cn.CellStyle.HorizontalAlign = HorizontalAlign.Right; UltraWebGrid1.Columns.Add(cn); } }
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { try { UltraGridColumn columnToSummarize = e.Layout.Bands[0].Columns[13]; SummarySettings summary = e.Layout.Bands[0].Summaries.Add("GrandTotal", SummaryType.Sum, columnToSummarize); summary.DisplayFormat = "Total Stock = {0}"; summary.Appearance.TextHAlign = Infragistics.Win.HAlign.Right; columnToSummarize = e.Layout.Bands[0].Columns[14]; summary = e.Layout.Bands[0].Summaries.Add("PriceAvg", SummaryType.Sum, columnToSummarize); summary.DisplayFormat = "Total Pedidos = {0}"; summary.Appearance.TextHAlign = Infragistics.Win.HAlign.Right; columnToSummarize = e.Layout.Bands[0].Columns[10]; summary = e.Layout.Bands[0].Summaries.Add("Promedio ", SummaryType.Average, columnToSummarize); summary.DisplayFormat = "Promedio PVP= {0:c}"; summary.Appearance.TextHAlign = Infragistics.Win.HAlign.Right; this.ultraGrid1.DisplayLayout.Override.SummaryFooterCaptionVisible = Infragistics.Win.DefaultableBoolean.False; e.Layout.Override.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed; e.Layout.Bands[0].Summaries.Add(SummaryType.Sum, e.Layout.Bands[0].Columns[59]); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); } }
private void HandleContextMenuMouseClick(object sender, EventArgs args) { ToolStripMenuItem menuItem = (ToolStripMenuItem)sender; UltraGridColumn column = ((ColumnHeader)menuItem.Tag)?.Column; switch (menuItem.Name) { case "add": this.AddNew(); break; case "delete": this.RemoveCurrent(); break; case "edit": this.PerformAction(UltraGridAction.EnterEditMode); break; case "excel": this.PerformExportToExcel(); break; case "filter": this.PerformFilter(column); break; case "copy": this.PerformAction(UltraGridAction.Copy); break; case "paste": this.PerformAction(UltraGridAction.Paste); break; case "asc": this.PerformSort(column, ImmasSortOrder.Asc); break; case "desc": this.PerformSort(column, ImmasSortOrder.Desc); break; case "none": this.PerformSort(null, ImmasSortOrder.None); break; } }
private void CustomGrid() { UltraGridColumn c = grdData.DisplayLayout.Bands[0].Columns["select"]; c.CellActivation = Activation.AllowEdit; c.CellClickAction = CellClickAction.Edit; }
public static void SetUltraColumnFormat(UltraGridColumn column, TextFormat textFormat) { column.MaskInput = textFormat.Mask; column.MaskDisplayMode = textFormat.MaskMode; column.CellAppearance.TextHAlign = textFormat.HAlign; column.PromptChar = textFormat.PromptChar; }
//Set grid cell text edito for lookup public static void SetCellLookupEditor ( UltraGridColumn col, EditorButtonEventHandler Event) { //Set part lookup editor for column var txtAssemblyPart = new UltraTextEditor { UseAppStyling = false }; var btnEditor = new EditorButton { Text = "..", Width = 17, Appearance = { TextHAlign = HAlign.Center } }; txtAssemblyPart.EditorButtonClick += Event; txtAssemblyPart.ButtonsRight.Add(btnEditor); col.ButtonDisplayStyle = ButtonDisplayStyle.Always; col.EditorComponent = txtAssemblyPart; }
public static void SetSortOrderColumns(UltraGrid dataGrid, string levelName, string orderString) { foreach (string str in orderString.Split(new char[] { ',' })) { string[] strArray = str.Trim().Split(new char[] { ' ' }); string columnKey = strArray[0].Trim(); string str3 = ""; if (strArray.Length > 1) { str3 = strArray[1].Trim().ToLower(); } else { str3 = "ASC"; } bool flag = str3 != "desc"; UltraGridColumn gridColumn = GetGridColumn(dataGrid, columnKey); if (gridColumn != null) { if (flag) { gridColumn.SortIndicator = SortIndicator.Ascending; } else { gridColumn.SortIndicator = SortIndicator.Descending; } } } }
public static void SetUltraGridValueList(UltraGridLayout layout, DataTable dataTable, UltraGridColumn column, string valueMember, string displayMember, string defaultValue) { ValueList vl; if (dataTable.TableName == null) { dataTable.TableName = string.Empty; } if (!layout.ValueLists.Exists(dataTable.TableName + valueMember + displayMember)) { vl = layout.ValueLists.Add(dataTable.TableName + valueMember + displayMember); } vl = layout.ValueLists[dataTable.TableName + valueMember + displayMember]; vl.ValueListItems.Clear(); if (defaultValue != null) { vl.ValueListItems.Add(-1, defaultValue); } foreach (DataRow row in dataTable.Rows) { vl.ValueListItems.Add(row[valueMember], row[displayMember].ToString()); } vl.SelectedItem = -1; column.ValueList = layout.ValueLists[dataTable.TableName + valueMember + displayMember]; }
private void frmBuscarServicioPendiente_Load(object sender, EventArgs e) { UltraGridColumn c = grdDataService.DisplayLayout.Bands[0].Columns["Seleccion"]; c.CellActivation = Activation.AllowEdit; c.CellClickAction = CellClickAction.Edit; }
public void ConfigurarPanel(ItemContenedor ItemContenedor) { String ConsultaSQL = String.Empty; String Ordenamiento = String.Empty; Text = String.Format(":: {0} ::", ItemContenedor.Nombre); if (!string.IsNullOrEmpty(FrmMain.Usuario.Imagen)) { if (File.Exists(String.Format("{0}{1}", FrmMain.CarpetaImagenes, FrmMain.Usuario.Imagen))) { ugDetails.DisplayLayout.Appearance.ImageBackground = Image.FromFile(String.Format("{0}{1}", FrmMain.CarpetaImagenes, FrmMain.Usuario.Imagen)); } } ugDetails.DataSource = null; Soft.Configuracion.Entidades.Panel Panel = (Soft.Configuracion.Entidades.Panel)HelperNHibernate.GetEntityByField("Panel", "Nombre", ItemContenedor.Panel.Nombre); foreach (ColumnaPanel Columna in Panel.Columnas) { UltraGridColumn Column = ugDetails.DisplayLayout.Bands[0].Columns.Add(Columna.CampoSQL); Column.Header.Caption = Columna.Nombre; Column.Width = Columna.Ancho; Column.Hidden = !Columna.Visible; if (Columna.Indice) { Ordenamiento = String.Format("ORDER BY {0}", Columna.CampoSQL); } } ConsultaSQL = String.Format("SELECT * FROM {0} {1} {2}", Panel.NombreVista, ItemContenedor.Filtro, Ordenamiento); ugDetails.DataSource = HelperNHibernate.GetDataSet(ConsultaSQL); if (ugDetails.Rows.Count > 0) { ugDetails.Rows[0].Selected = true; } RecuperarFiltros(); }
public Delayed(User _user) { user = _user; InitializeComponent(); PrepareColumns(); using (var db = new MarketDbContext()) { Orders = db.Orders.Include("Client.Village").Include("OrderDetails.ProductType.GeneralProductTypes").ToList(); Clients = db.Clients.Include("Village").ToList(); Villages = db.Villages.ToList(); } FillWithData(Orders); // all columns auto resize OrdersDataGrid.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns; // hide drag header area OrdersDataGrid.DisplayLayout.ViewStyleBand = ViewStyleBand.Vertical; // center content this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[0].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[1].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[2].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[3].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[4].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[5].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[6].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[7].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[8].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[9].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[10].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[11].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[12].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; // first column as checkbox UltraGridColumn ugc = OrdersDataGrid.DisplayLayout.Bands[0].Columns["Selected"]; ugc.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox; ugc.CellActivation = Activation.AllowEdit; // stop confirmation message on delete OrdersDataGrid.DisplayLayout.ShowDeleteRowsPrompt = false; // hide id column this.OrdersDataGrid.DisplayLayout.Bands[0].Columns[1].Hidden = true; this.comboClient.DataSource = Clients.Select(x => new { Name = x.Name + " - " + x.Number, ClientId = x.ClientId }).ToList(); this.comboClient.DisplayMember = "Name"; this.comboClient.Name = "Name"; this.comboClient.ValueMember = "ClientId"; this.comboVillage.DataSource = Villages; this.comboVillage.DisplayMember = "VillageName"; this.comboVillage.Name = "VillageName"; this.comboVillage.ValueMember = "VillageId"; btnSearch_Click(null, null); }
private void SetComboBoxColumnProperties(bool setColumnsWidth) { if (DataAdapterFactory.Provider == null) { DataAdapterFactory.Provider = new SimpleDataAdapterFactory(); } DataSet dataSet = new AKTIVNOSTDataSet(); if (DataAdapterFactory.Provider != null) { DataAdapterFactory.GetAKTIVNOSTDataAdapter().Fill(dataSet); } System.Data.DataView dataList = new System.Data.DataView(dataSet.Tables["AKTIVNOST"]) { Sort = "NAZIVAKTIVNOST" }; CreateValueList(this.DataGrid, "AKTIVNOSTIDAKTIVNOST", dataList, "IDAKTIVNOST", "NAZIVAKTIVNOST"); UltraGridColumn column = this.DataGrid.DisplayLayout.Bands["KONTO"].Columns["IDAKTIVNOST"]; column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; column.ValueList = this.DataGrid.DisplayLayout.ValueLists["AKTIVNOSTIDAKTIVNOST"]; if (setColumnsWidth) { column.Width = 370; } }
private void fillUltraCombo() { //Add an additional unbound column to WinCombo. //This will be used for the Selection of each Item UltraGridColumn c = this.ultraCombo1.DisplayLayout.Bands[0].Columns.Add(); ultraCombo1.DisplayLayout.Bands[0].Override.ActiveRowAppearance.BackColor = Color.Orange; ultraCombo1.DisplayLayout.Bands[0].Override.BorderStyleRow = UIElementBorderStyle.Dashed; c.Key = "Selected"; c.Header.Caption = string.Empty; //This allows end users to select / unselect ALL items c.Header.CheckBoxVisibility = HeaderCheckBoxVisibility.Always; c.DataType = typeof(bool); //Move the checkbox column to the first position. c.Header.VisiblePosition = 0; this.ultraCombo1.CheckedListSettings.CheckStateMember = "Selected"; this.ultraCombo1.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItems; // Set up the control to use a custom list delimiter this.ultraCombo1.CheckedListSettings.ListSeparator = " / "; // Set ItemCheckArea to Item, so that clicking directly on an item also checks the item this.ultraCombo1.CheckedListSettings.ItemCheckArea = Infragistics.Win.ItemCheckArea.Item; this.ultraCombo1.DisplayMember = "Name"; this.ultraCombo1.ValueMember = "TagId"; }
private void SetComboBoxColumnProperties(bool setColumnsWidth) { if (DataAdapterFactory.Provider == null) { DataAdapterFactory.Provider = new SimpleDataAdapterFactory(); } DataSet dataSet = new PARTNERDataSet(); if (DataAdapterFactory.Provider != null) { DataAdapterFactory.GetPARTNERDataAdapter().Fill(dataSet); } System.Data.DataView dataList = new System.Data.DataView(dataSet.Tables["PARTNER"]) { Sort = "PT" }; CreateValueList(this.DataGrid, "PARTNERIDPARTNER", dataList, "IDPARTNER", "PT"); UltraGridColumn column = this.DataGrid.DisplayLayout.Bands["S_FIN_OTVORENE_STAVKE"].Columns["IDPARTNER"]; column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; column.ValueList = this.DataGrid.DisplayLayout.ValueLists["PARTNERIDPARTNER"]; if (setColumnsWidth) { column.Width = 370; } }
public void ConfigureColumns(String NombrePanel, String Filtro) { String ConsultaSQL = String.Empty; String Ordenamiento = String.Empty; UltraGridBand Band = ugEntity.DisplayLayout.Bands[0]; mPanel = (Soft.Configuracion.Entidades.Panel)HelperNHibernate.GetEntityByField("Panel", "Nombre", NombrePanel); foreach (ColumnaPanel Columna in mPanel.Columnas) { UltraGridColumn Column = Band.Columns.Add(Columna.CampoSQL); Column.CellActivation = Activation.NoEdit; Column.Header.Caption = Columna.Nombre; Column.Width = Columna.Ancho; Column.Hidden = !Columna.Visible; if (Columna.Indice) { Ordenamiento = String.Format("ORDER BY {0}", Columna.CampoSQL); } } if (Filtro.Length > 0) { Filtro = String.Format(" WHERE {0} ", Filtro); } ConsultaSQL = String.Format("SELECT * FROM {0} {1} {2}", mPanel.NombreVista, Filtro, Ordenamiento); ugEntity.DataSource = HelperNHibernate.GetDataSet(ConsultaSQL); }
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Bands[0].Columns["ConfigXML"].Hidden = true; e.Layout.Bands[0].Columns["ID"].Hidden = true; e.Layout.Bands[0].Columns["Title"].CellActivation = Activation.ActivateOnly; e.Layout.Bands[0].Columns["Title"].Width = 284; e.Layout.Bands[0].Columns["Title"].SortIndicator = SortIndicator.Ascending; e.Layout.Bands[0].Columns["CreatedDate"].Header.Caption = "Created On"; e.Layout.Bands[0].Columns["CreatedDate"].Format = "MM/dd/yy"; e.Layout.Bands[0].Columns["CreatedDate"].EditorControl = ultraCalendarCombo1; e.Layout.Bands[0].Columns["ModifiedDate"].Header.Caption = "Modified On"; e.Layout.Bands[0].Columns["ModifiedDate"].Format = "MM/dd/yy"; e.Layout.Bands[0].Columns["ModifiedDate"].EditorControl = ultraCalendarCombo1; e.Layout.Bands[0].Columns["CreatedDate"].CellActivation = Activation.Disabled; e.Layout.Bands[0].Columns["ModifiedDate"].CellActivation = Activation.Disabled; this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true; this.ultraGrid1.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False; e.Layout.Override.FilterUIType = FilterUIType.HeaderIcons; this.ultraGrid1.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect; this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.Reset(); this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance.Reset(); e.Layout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True; UltraGridColumn col = e.Layout.Bands[0].Columns["ReportType"]; e.Layout.Bands[0].SortedColumns.Add(col, false); this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.RefreshSort(true); }
/// <summary> /// Apply config info to UltraGrid /// </summary> public void ConfigGrid(UltraGrid grid) { if (grid == null || grid.DisplayLayout.Bands.Count < 1) { return; } else { this.mainGrid = grid; } ColumnsCollection uColumns = grid.DisplayLayout.Bands[0].Columns; HashSet <string> hs = new HashSet <string>(StringComparer.OrdinalIgnoreCase); //int tempPos = 999; foreach (UltraGridColumn uCol in uColumns) { hs.Add(uCol.Key); //uCol.Hidden = true; //Console.WriteLine(uCol.Key + " Position:" + uCol.Header.VisiblePosition); } foreach (HssGridColumn hgc in this.colKey_list) { if (!hs.Contains(hgc.column_key)) { continue; } UltraGridColumn uCol = uColumns[hgc.column_key]; hgc.ConfigColumn(uCol); } }
private void SetComboBoxColumnProperties(bool setColumnsWidth) { if (DataAdapterFactory.Provider == null) { DataAdapterFactory.Provider = new SimpleDataAdapterFactory(); } DataSet dataSet = new LOKACIJEDataSet(); if (DataAdapterFactory.Provider != null) { DataAdapterFactory.GetLOKACIJEDataAdapter().Fill(dataSet); } System.Data.DataView dataList = new System.Data.DataView(dataSet.Tables["LOKACIJE"]) { Sort = "LOK" }; CreateValueList(this.DataGrid, "LOKACIJEIDLOKACIJE", dataList, "IDLOKACIJE", "LOK"); UltraGridColumn column = this.DataGrid.DisplayLayout.Bands["OSRAZMJESTAJ"].Columns["IDLOKACIJE"]; column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; column.ValueList = this.DataGrid.DisplayLayout.ValueLists["LOKACIJEIDLOKACIJE"]; if (setColumnsWidth) { column.Width = 370; } }
private void SetComboBoxColumnProperties(bool setColumnsWidth) { if (DataAdapterFactory.Provider == null) { DataAdapterFactory.Provider = new SimpleDataAdapterFactory(); } DataSet dataSet = new IZVORDOKUMENTADataSet(); if (DataAdapterFactory.Provider != null) { DataAdapterFactory.GetIZVORDOKUMENTADataAdapter().Fill(dataSet); } System.Data.DataView dataList = new System.Data.DataView(dataSet.Tables["IZVORDOKUMENTA"]) { Sort = "SIFRAIZVORA" }; CreateValueList(this.DataGrid, "IZVORDOKUMENTASIFRAIZVORA", dataList, "SIFRAIZVORA", "SIFRAIZVORA"); UltraGridColumn column = this.DataGrid.DisplayLayout.Bands["KORISNIK_KORISNIKLevel1"].Columns["SIFRAIZVORA"]; column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; column.ValueList = this.DataGrid.DisplayLayout.ValueLists["IZVORDOKUMENTASIFRAIZVORA"]; if (setColumnsWidth) { column.Width = 0x5b; } }
/// <summary> /// Handles the MouseEnterElement event of the SearchResultGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:Infragistics.Win.UIElementEventArgs"/> instance containing the event data.</param> private void SearchResultGrid_MouseEnterElement(object sender, UIElementEventArgs e) { try { if (e.Element != null) { UltraGridColumn col = e.Element.GetContext(typeof(UltraGridColumn)) as UltraGridColumn; UltraGridRow row = e.Element.GetContext(typeof(UltraGridRow)) as UltraGridRow; if (e.Element.GetType().Equals(typeof(Infragistics.Win.UltraWinGrid.MergedCellUIElement))) { this.toolTipMessage = this.SearchResultGrid.Rows[row.Index].Cells[this.searchData.GroupColumn.ColumnName].Value.ToString(); this.SearchEngineToolTip.SetToolTip(SearchResultGrid, this.toolTipMessage); } else { if (col != null && row != null) { ////msg = this.ultraGrid1.Rows[row.Index].Cells[col.Index].Value.ToString(); ////GdocEventEngineToolTip.SetToolTip(ultraGrid1, msg); this.SearchResultGrid.DisplayLayout.Override.TipStyleCell = TipStyle.Show; } } } } catch (SoapException ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } }
public static void SetUltraGridValueList <T>(UltraGridLayout layout, IEnumerable <T> collection, UltraGridColumn column, string valueMember, string displayMember, string defaultValue) { ValueList vl; if (!layout.ValueLists.Exists(typeof(T).Name + valueMember + displayMember)) { vl = layout.ValueLists.Add(typeof(T).Name + valueMember + displayMember); } vl = layout.ValueLists[typeof(T).Name + valueMember + displayMember]; vl.ValueListItems.Clear(); if (defaultValue != null) { vl.ValueListItems.Add(-1, defaultValue); } foreach (T entity in collection) { vl.ValueListItems.Add(entity.GetType().GetProperty(valueMember).GetValue(entity, null), entity.GetType().GetProperty(displayMember).GetValue(entity, null).ToString()); } vl.SelectedItem = -1; //column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; column.ValueList = layout.ValueLists[typeof(T).Name + valueMember + displayMember]; }
private void InitializeComponent() { this.userControlDataGridBENEFICIRANI = new BENEFICIRANIDataGrid(); ((ISupportInitialize)this.userControlDataGridBENEFICIRANI).BeginInit(); UltraGridBand band = new UltraGridBand("BENEFICIRANI", -1); UltraGridColumn column2 = new UltraGridColumn("IDBENEFICIRANI"); UltraGridColumn column3 = new UltraGridColumn("NAZIVBENEFICIRANI"); UltraGridColumn column = new UltraGridColumn("BROJPRIZNATIHMJESECI"); this.SuspendLayout(); Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance(); column2.CellActivation = Activation.NoEdit; column2.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnCellActivate; column2.Header.Caption = StringResources.BENEFICIRANIIDBENEFICIRANIDescription; column2.Width = 240; column2.Format = ""; column2.CellAppearance = appearance2; Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance(); column3.CellActivation = Activation.NoEdit; column3.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnCellActivate; column3.Header.Caption = StringResources.BENEFICIRANINAZIVBENEFICIRANIDescription; column3.Width = 0x128; column3.Format = ""; column3.CellAppearance = appearance3; Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance(); column.CellActivation = Activation.NoEdit; column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnCellActivate; column.Header.Caption = StringResources.BENEFICIRANIBROJPRIZNATIHMJESECIDescription; column.Width = 0x120; appearance.TextHAlign = HAlign.Right; column.MaskInput = "{LOC}-nn"; column.PromptChar = ' '; column.Format = ""; column.CellAppearance = appearance; band.Columns.Add(column2); column2.Header.VisiblePosition = 0; band.Columns.Add(column3); column3.Header.VisiblePosition = 1; band.Columns.Add(column); column.Header.VisiblePosition = 2; this.userControlDataGridBENEFICIRANI.Visible = true; System.Drawing.Point point = new System.Drawing.Point(0, 0); this.userControlDataGridBENEFICIRANI.Location = point; this.userControlDataGridBENEFICIRANI.Name = "userControlDataGridBENEFICIRANI"; this.userControlDataGridBENEFICIRANI.Tag = "BENEFICIRANI"; this.userControlDataGridBENEFICIRANI.Size = new System.Drawing.Size(0x200, 0x144); this.userControlDataGridBENEFICIRANI.DisplayLayout.BorderStyle = UIElementBorderStyle.None; this.userControlDataGridBENEFICIRANI.Dock = DockStyle.Fill; this.userControlDataGridBENEFICIRANI.FillAtStartup = false; this.userControlDataGridBENEFICIRANI.DisplayLayout.Appearance.TextHAlign = HAlign.Left; this.userControlDataGridBENEFICIRANI.InitializeRow += new InitializeRowEventHandler(this.BENEFICIRANIUserDataGrid_InitializeRow); this.userControlDataGridBENEFICIRANI.DisplayLayout.BandsSerializer.Add(band); this.Controls.AddRange(new Control[] { this.userControlDataGridBENEFICIRANI }); this.Name = "BENEFICIRANIUserDataGrid"; this.Size = new System.Drawing.Size(0x200, 0x144); this.Load += new EventHandler(this.BENEFICIRANIUserDataGrid_Load); ((ISupportInitialize)this.userControlDataGridBENEFICIRANI).EndInit(); this.ResumeLayout(false); }
public static void FormatMobile(this UltraGridColumn @column) { @column.MaskInput = @"{LOC}####-###-####"; @column.MaskDataMode = MaskMode.IncludeLiteralsWithPadding; @column.MaskDisplayMode = MaskMode.IncludeBoth; @column.MaskClipMode = MaskMode.IncludeLiterals; @column.PromptChar = ' '; }
public FilterPopupForm(ImmasGrid grid, UltraGridColumn column) { InitializeComponent(); this.Grid = grid; this.Column = column; this.Text = this.Text + $"[{column.Header.Caption}]"; }
private void ChangeDataGridStyle(bool add) { IEnumerator enumerator = null; try { enumerator = this.DataGrids.GetEnumerator(); while (enumerator.MoveNext()) { UltraGrid current = (UltraGrid)enumerator.Current; UltraGridBand band = current.DisplayLayout.Bands[0]; ColumnEnumerator enumerator2 = band.Columns.GetEnumerator(); while (enumerator2.MoveNext()) { IEnumerator enumerator3 = null; UltraGridColumn column = enumerator2.Current; string key = column.Key; bool flag = false; try { enumerator3 = new AttributeAllKeysEnumeratorCollection(this.formDataSet.Tables).GetEnumerator(); while (enumerator3.MoveNext()) { if (Conversions.ToString(enumerator3.Current) == key) { flag = true; } } } finally { if (enumerator3 is IDisposable) { (enumerator3 as IDisposable).Dispose(); } } if (flag) { if (add) { column.CellActivation = Activation.AllowEdit; } else { column.CellActivation = Activation.ActivateOnly; } } } } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } }
/// <summary> /// Handles the InitializeLayout event of the gridInventory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs"/> instance containing the event data.</param> private void gridInventory_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns; layout.Override.CellClickAction = CellClickAction.RowSelect; layout.LoadStyle = LoadStyle.LoadOnDemand; layout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False; layout.Override.RowSizing = RowSizing.Fixed; layout.Override.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center; layout.Override.CellAppearance.TextVAlign = Infragistics.Win.VAlign.Middle; layout.Override.HeaderClickAction = HeaderClickAction.SortMulti; layout.Override.CellSpacing = 3; UltraGridBand band = layout.Bands[0]; if (band.Key == "Deliveries") { band.Columns["EndDateTime"].Hidden = true; band.Columns["AllDayEvent"].Hidden = true; band.Columns["Category"].Hidden = true; band.Columns["DataKey"].Header.Caption = Properties.Resources.PartNumber; band.Columns["Weight"].Header.Caption = Properties.Resources.TotalWeightLbs; band.Columns["Cost"].Header.Caption = Properties.Resources.TotalDue; band.Columns["Subject"].Header.Caption = Properties.Resources.Subject; band.Columns["Description"].Header.Caption = Properties.Resources.Description; band.Columns["Count"].Header.Caption = Properties.Resources.Count; UltraGridColumn column = band.Columns["StartDateTime"]; column.Header.Caption = Properties.Resources.DeliveryDate; column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateWithoutDropDown; band.SortedColumns.Add(column, false); } else { UltraGridColumn column = band.Columns["WeightPerItem"]; column.Header.Caption = Properties.Resources.WeightLbs; column.Format = "F1"; column = band.Columns["PricePerItem"]; column.Header.Caption = Properties.Resources.PricePerItem; column.Format = "C"; band.Columns["PartNumber"].Header.Caption = Properties.Resources.PartNumber; band.Columns["InStock"].Header.Caption = Properties.Resources.InStock; band.Columns["Manufacturer"].Header.Caption = Properties.Resources.Manufacturer; band.Columns["Component"].Header.Caption = Properties.Resources.Component; // Add a column for the Orders ("Order Part", "View Shipment") button if (band.Columns.IndexOf("Orders") == -1) { UltraGridColumn deliveries = band.Columns.Add("Orders"); deliveries.Header.Caption = Properties.Resources.Availability; deliveries.DataType = typeof(string); deliveries.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button; deliveries.ButtonDisplayStyle = ButtonDisplayStyle.Always; } } }
/// <summary> /// Evento que identifica aonde na área gráfica o usuário clicou para apresentar /// os menus suspensos. /// </summary> private void udgv_MouseUp(object sender, MouseEventArgs e) { //Variáveis utilizadas dentro das condições. int xMax = 0, yMax = 0; //Link de ajuda: //https://www.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/13204/ultragrid-groupbybox-height //Obtenho esse 'gridElement' para saber o tamanho do groupbybox, para determinar //até que ponto do click na área gráfico eu posso mostrar determinado menu suspenso. UIElement gridElement = mUdgv.DisplayLayout.UIElement; if (gridElement != null) { UIElement groupByBoxUIElement = gridElement.GetDescendant(typeof(GroupByBoxUIElement)); if (groupByBoxUIElement != null) { xMax = groupByBoxUIElement.Rect.Width; yMax = groupByBoxUIElement.Rect.Height; } } //Caso o grid tenha um agrupamento, mostro o menu suspenso para expandir todos os agrupamentos (não mexer). if (e.Button == System.Windows.Forms.MouseButtons.Right && e.Y >= 0 && e.X >= 0 && e.X <= 10) { //Link de ajuda: //http://help.infragistics.com/Help/Doc/WinForms/2013.1/CLR4.0/html/WinGrid_Expand_All_Rows_in_WinGrid.html //if (udgv.DisplayLayout.Bands[0].ColumnFilters.Count > 0) if (GridPossuiAgrupamento(mUdgv)) { cms_Expandir.Show(mUdgv, new Point(e.X, e.Y)); } } //Caso o usuário clicar sobre o agrupador de colunas, exibe o Context Menu Strip para limpar o agrupamento. else if (e.Button == System.Windows.Forms.MouseButtons.Right && e.X <= xMax && e.Y <= yMax) { //mUdgv.DisplayLayout.GroupByBox.Appearance. cms_RemoveGroupByBox.Show(mUdgv, new Point(e.X, e.Y)); } //Caso o usuário clicar sobre as colunas, exibe o Context Menu Strip para escolher as colunas. else if (e.Button == System.Windows.Forms.MouseButtons.Right && e.Y >= 35 && e.Y <= 55) { //Obtém um objeto da coluna UIElement ue = ((UltraGrid)sender).DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y)); mColunaOrdenar = (UltraGridColumn)ue.GetContext(typeof(UltraGridColumn), true); //Adiciona o nome da coluna no controle 'btnAscendente/btnDescendente' if (mColunaOrdenar != null) { btnAgruparColuna.Text = String.Format("Agrupar pela coluna '{0}'", mColunaOrdenar.Key); btnAscendente.Text = String.Format("Ordenar coluna '{0}' ascendente", mColunaOrdenar.Key); btnDescendente.Text = String.Format("Ordenar coluna '{0}' descendente", mColunaOrdenar.Key); } cms_EscolherColunas.Show(mUdgv, new Point(e.X, e.Y)); } }
public static void FormatMonney(this UltraGridColumn @column) { @column.Format = @"n"; @column.MaskInput = @"{LOC}-nnn,nnn,nnn,nnn,nnn.nn"; @column.MaskDataMode = MaskMode.IncludeLiteralsWithPadding; @column.MaskDisplayMode = MaskMode.IncludeBoth; @column.MaskClipMode = MaskMode.IncludeLiterals; @column.PromptChar = ' '; }
private void grdRegionOption_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; UltraGridColumn imageColumn = band.Columns.Add("Delete"); imageColumn.DataType = typeof(Image); imageColumn.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Image; }
public static void SetUltraColumnFormat(UltraGridColumn column, GridCellFormat gridCellFormat) { switch (gridCellFormat) { case GridCellFormat.Currency: column.MaskInput = currencyMask; column.MaskDisplayMode = MaskMode.IncludeBoth; column.CellAppearance.TextHAlign = HAlign.Right; column.PromptChar = ' '; break; case GridCellFormat.NaturalQuantity: column.MaskInput = naturalQuantityMask; column.MaskDisplayMode = MaskMode.IncludeBoth; column.CellAppearance.TextHAlign = HAlign.Right; column.PromptChar = ' '; break; case GridCellFormat.RealQuantity: column.MaskInput = realQuantityMask; column.MaskDisplayMode = MaskMode.IncludeBoth; column.CellAppearance.TextHAlign = HAlign.Right; column.PromptChar = ' '; break; case GridCellFormat.Rate: column.MaskInput = rateMask; column.MaskDisplayMode = MaskMode.IncludeBoth; column.CellAppearance.TextHAlign = HAlign.Right; column.PromptChar = ' '; break; case GridCellFormat.Percentage: column.MaskInput = percentageMask; column.MaskDisplayMode = MaskMode.IncludeBoth; column.CellAppearance.TextHAlign = HAlign.Right; column.PromptChar = ' '; break; case GridCellFormat.NoLimitPercentage: column.MaskInput = noLimitPercentageMask; column.MaskDisplayMode = MaskMode.IncludeBoth; column.CellAppearance.TextHAlign = HAlign.Right; column.PromptChar = ' '; break; case GridCellFormat.FileSize: column.MaskInput = fileSizeMask; column.MaskDisplayMode = MaskMode.IncludeBoth; column.CellAppearance.TextHAlign = HAlign.Right; column.PromptChar = ' '; break; default: break; } }
public bool ShouldCellsBeMerged(UltraGridRow row1,UltraGridRow row2, UltraGridColumn column) { // Test to make sure the Type is not DBNull since we allow the ShippedDate to be null if (row1.GetCellValue(column).GetType().ToString() != "System.DBNull" && row2.GetCellValue(column).GetType().ToString() != "System.DBNull") { string value1 = row1.GetCellValue(column).ToString(); string value2 = row2.GetCellValue(column).ToString(); // Merge cells according to the date portions of the underlying DateTime cell // values, ignoring any time portion. For example, "1/1/2004 10:30 AM" will be // merged with "1/1/2004 1:15 AM" since the dates are the same. return value1.Equals(value2); } else return false; }
public void UltraWebGrid(UltraWebGrid tmpUltraWebGrid, string condition, string[] captionNames, string[] tableColumns) { //tmpUltraWebGrid.Clear(); //清空 tmpUltraWebGrid.Bands[0].Columns.Clear(); //清空數據列 UltraGridBand band = new UltraGridBand(); band = tmpUltraWebGrid.Bands[0]; //Head行 UltraGridColumn tmpHeadColumn = new UltraGridColumn(); UltraGridCell tmpCell = new UltraGridCell(); band.Columns.Add(tmpHeadColumn); //數據行 UltraGridColumn tmpColumn = new UltraGridColumn(); // tmpColumn.Band. band.Columns.Add(tmpColumn); //動態增加列 }
/// <summary> /// Finds a row in the grid based on the specified searchString and column and activates the cell if found. /// </summary> /// <param name="searchString">A string to search for in the grid.</param> /// <param name="column">The column to search.</param> /// <returns>An UltraGrid row where the specified column value begins with the specified searchString.</returns> /// <remarks> /// This method searches the specified column. /// The text that is searched for is a string that starts with the specified searchString. /// This method is different from FindRow in that it automatically activates the row and cell if it finds a match. /// </remarks> public static UltraGridRow PerformSearch(string searchString, UltraGridColumn column) { // Find the row. UltraGridRow row = WinGridKeyboardSearchHelper.FindRow(searchString, column); // If the row was found, scroll it into view and activate the cell. if (row != null) { // Get the grid. UltraGrid grid = WinGridKeyboardSearchHelper.GetGrid(column); // Scroll the row into view on the ActiveRowScrollRegion. grid.ActiveRowScrollRegion.ScrollRowIntoView(row); // Set the ActiveRow. grid.ActiveRow = row; // Set the ActiveCell. grid.ActiveCell = row.Cells[column]; } // Return the row that was found. return row; }
private void pGridSelectAll(UltraGrid grid, UltraGridColumn checkColumn, bool value) { foreach (var row in grid.Rows) { row.Cells[checkColumn].Value = value; } }
private void pGridInvertSelection(UltraGrid grid, UltraGridColumn checkColumn) { foreach (UltraGridRow row in grid.Rows) { row.Cells[checkColumn].Value = !(bool)row.Cells[checkColumn].Value; } grid.UpdateData(); grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode); }
private void pGridInvertSelection(UltraGrid grid, UltraGridColumn checkColumn) { foreach (var row in grid.Rows) { row.Cells[checkColumn].Value = !(bool) row.Cells[checkColumn].Value; } }
//Set grid cell text edito for lookup public static void SetCellLookupEditor( UltraGridColumn col, EditorButtonEventHandler Event) { //Set part lookup editor for column var txtAssemblyPart = new UltraTextEditor { UseAppStyling = false }; var btnEditor = new EditorButton { Text = "..", Width = 17, Appearance = { TextHAlign = HAlign.Center } }; txtAssemblyPart.EditorButtonClick += Event; txtAssemblyPart.ButtonsRight.Add(btnEditor); col.ButtonDisplayStyle = ButtonDisplayStyle.Always; col.EditorComponent = txtAssemblyPart; }
protected override void processLeftClick(UltraGridColumn columnClicked_) { Logger.Debug(columnClicked_ == null ? string.Empty : columnClicked_.Key,typeof(CountryCurveGrid)); }
private void InitializeGrid() { clsSchedule cSchedule = new clsSchedule(); int intHeight = 0; int intI = 0; UltraGridLayout uwgLayout = this.uwgProjects.DisplayLayout; string weekLabel = null; int gridWidth = 595; // uwgLayout.RowHeightDefault = Unit.Pixel(13); // sets the height of the control if (Convert.ToInt32(Session["ScreenH"]) != 0) { intHeight = cSchedule.GetGridHeight(Session["ScreenH"].GetValueOrDefault<string>()); this.uwgProjects.Height = Unit.Pixel(intHeight); } ///'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' //changes the sort icons uwgLayout.ImageUrls.SortDescending = "./images/spacer.gif"; uwgLayout.ImageUrls.SortAscending = "./images/spacer.gif"; // First Band uwgLayout.Bands[0].AllowUpdate = AllowUpdate.No; this.uwgProjects.Bands[0].DefaultColWidth = Unit.Pixel(100); // // 0 this.uwgProjects.Bands[0].Columns.FromKey("ProjectID").Hidden = true; //1 UltraGridColumn restoreColumn = this.uwgProjects.Bands[0].Columns.FromKey("Restore"); if ((restoreColumn == null)) { restoreColumn = new UltraGridColumn(); this.uwgProjects.Bands[0].Columns.Insert(1, restoreColumn); } restoreColumn.Header.Caption = "Restore"; restoreColumn.Key = "Restore"; restoreColumn.Type = ColumnType.CheckBox; restoreColumn.CellStyle.HorizontalAlign = HorizontalAlign.Center; restoreColumn.Width = 70; restoreColumn.AllowUpdate = AllowUpdate.Yes; // 2 this.uwgProjects.Bands[0].Columns.FromKey("ProjectNo").Header.Caption = "JOB #"; this.uwgProjects.Bands[0].Columns.FromKey("ProjectNo").Width = Unit.Pixel(85); // 3 this.uwgProjects.Bands[0].Columns.FromKey("ProjectName").Header.Caption = "PROJECT"; this.uwgProjects.Bands[0].Columns.FromKey("ProjectName").Width = Unit.Pixel(260); // 4 this.uwgProjects.Bands[0].Columns.FromKey("PICCode").Header.Caption = "PIC"; this.uwgProjects.Bands[0].Columns.FromKey("PICCode").Width = Unit.Pixel(70); // 5 this.uwgProjects.Bands[0].Columns.FromKey("PM1Code").Header.Caption = "PM"; this.uwgProjects.Bands[0].Columns.FromKey("PM1Code").Width = Unit.Pixel(70); for (intI = 6; intI <= 15; intI++) { this.uwgProjects.Bands[0].Columns[intI].CellStyle.HorizontalAlign = HorizontalAlign.Center; weekLabel = strWeekLabel[intI - 6]; if ((weekLabel.Length > 4)) { this.uwgProjects.Bands[0].Columns[intI].Width = Unit.Pixel(45); gridWidth += 45; } else { this.uwgProjects.Bands[0].Columns[intI].Width = Unit.Pixel(35); gridWidth += 35; } this.uwgProjects.Bands[0].Columns[intI].Header.Style.CssClass = "WeekHeaderStyle"; this.uwgProjects.Bands[0].Columns[intI].Header.Caption = weekLabel; this.uwgProjects.Bands[0].Columns[intI].DataType = "System.Decimal"; } this.uwgProjects.Width = Unit.Pixel(gridWidth); }
/// <summary> /// Gets a grid from a column /// </summary> /// <param name="column">An UltraGridColumn</param> /// <returns>Returns the grid to which the column belongs.</returns> private static UltraGrid GetGrid(UltraGridColumn column) { // If the column is null, return null; if (column == null) return null; // If the layout is null, return null; if (column.Layout == null) return null; // Return the grid. return column.Layout.Grid as UltraGrid; }
/// <summary> /// Determines if the row matches the search criteria based on the search string. /// </summary> /// <param name="row">The row to be evaluated.</param> /// <param name="column">The column being searched.</param> /// <param name="searchString">The string to search for. The searchString should be in all lower case.</param> /// <returns></returns> private static bool DoesRowMeetSearchCriteria(UltraGridRow row, UltraGridColumn column, string searchString) { // If this row is hidden, it should never be picked up by a // keyboard search. if (row.HiddenResolved) return false; // Get the text of the specified column in this row. Convert // it to lower case so the search is no case sensitive. string rowText = row.GetCellText(column).ToLower(); // If the row text starts with the searchString, return true return rowText.StartsWith(searchString); }
/// <summary> /// Finds a row in the grid based on the specified string and column. /// </summary> /// <param name="searchString">A string to search for in the grid.</param> /// <param name="column">The column to search.</param> /// <returns>An UltraGrid row where the specified column value begins with the specified searchString.</returns> /// <remarks> /// This method searches the specified column. /// The text that is searched for is a string that starts with the searchString passed in. /// </remarks> public static UltraGridRow FindRow(string searchString, UltraGridColumn column) { // If the searchString is empty, return null; if (searchString.Length == 0) return null; // If the column is null, return null. if (column == null) return null; // Get the grid from the column. UltraGrid grid = WinGridKeyboardSearchHelper.GetGrid(column); // If the grid is null, return null; if (grid == null) return null; // If the grid has no rows, return null; if (grid.Rows.Count == 0) return null; // Get the ActiveRow in the grid. This will be where the search starts. UltraGridRow startRow = grid.ActiveRow; // If there is no active row, use the first row in the grid as the starting point. if (startRow == null) startRow = grid.Rows[0]; // Convert the search string to lower case, so the search is not // case sensitive. searchString = searchString.ToLower(); // Begin at the startRow and go to the last row in the grid. for (int i = startRow.Index; i < grid.Rows.Count; i++) { // Get the row to be evaluated. UltraGridRow row = grid.Rows[i]; // Determine if this row meets the search criteria and if so, return it. if (WinGridKeyboardSearchHelper.DoesRowMeetSearchCriteria(row, column, searchString)) return row; } // If we failed to find the row, go back up to the top of the grid // and search down from there. First, make sure we did not already // start at the top. if (startRow.Index > 0) { // Start at the first row in the grid and go to the original // starting row. for (int i = 0; i < startRow.Index; i++) { // Get the row to be evaluated. UltraGridRow row = grid.Rows[i]; // Determine if this row meets the search criteria and if so, return it. if (WinGridKeyboardSearchHelper.DoesRowMeetSearchCriteria(row, column, searchString)) return row; } } // If we have gotten to this point and have not found the row, // return null. return null; }