private void gridView1_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView aView = gridView1.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView; if (aView != null) { aView.Columns["id"].Visible = false; //aView就是子View,设置VID 列为隐藏 aView.Columns["shd_bh"].Visible = false; aView.Columns["shd_pf_bh"].Caption = "配方编号"; aView.Columns["shd_pf_sl"].Caption = "配方数量"; aView.Columns["shd_pf_jg"].Caption = "配方价格"; aView.Columns["shd_pf_ys"].Caption = "配方颜色"; aView.Columns["shd_pf_jz"].Caption = "配方胶质"; aView.Columns["shd_pf_dw"].Caption = "配方单位"; aView.Columns["shd_pf_bh"].OptionsColumn.AllowEdit = false; aView.Columns["shd_pf_sl"].OptionsColumn.AllowEdit = false; aView.Columns["shd_pf_jg"].OptionsColumn.AllowEdit = false; aView.Columns["shd_pf_ys"].OptionsColumn.AllowEdit = false; aView.Columns["shd_pf_jz"].OptionsColumn.AllowEdit = false; aView.Columns["shd_pf_dw"].OptionsColumn.AllowEdit = false; aView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFullFocus; //aView.OptionsView.ShowFooter = true ; //aView.Columns["shd_pf_jg"].Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { //new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "shd_pf_jg", "总计:{0:0.##}")}); aView.BestFitColumns(); } }
private void gridView1_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView masterView = sender as DevExpress.XtraGrid.Views.Grid.GridView; DevExpress.XtraGrid.Views.Grid.GridView detailView = masterView.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView; if (e.RelationIndex == 0) { detailView.Columns["CustomerOID"].Visible = false; // detailView.Columns[1].Visible = false; detailView.Columns["CREATE_BY"].Visible = false; detailView.Columns["CREATE_DATE"].Visible = false; detailView.Columns["UPDATE_BY"].Visible = false; detailView.Columns["UPDATE_DATE"].Visible = false; detailView.Columns["ROW_STATE"].Visible = false; detailView.Columns["ImportID"].Visible = false; } else if (e.RelationIndex == 1) { detailView.Columns["AddressOID"].Visible = false; detailView.Columns["RelateCustomerKYCID"].Visible = false; detailView.Columns["CustomerOID"].Visible = false; detailView.Columns["CREATE_BY"].Visible = false; detailView.Columns["CREATE_DATE"].Visible = false; detailView.Columns["UPDATE_BY"].Visible = false; detailView.Columns["UPDATE_DATE"].Visible = false; detailView.Columns["ROW_STATE"].Visible = false; detailView.Columns["ImportID"].Visible = false; } }
private void gridView1_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView aView = gridView1.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView; if (aView != null) { aView.Columns["id"].Visible = false; //aView就是子View,设置VID 列为隐藏 aView.Columns["pid"].Visible = false; aView.Columns["pf_yf_bh"].Caption = "原粉编号"; aView.Columns["pf_yf_sl"].Caption = "原粉数量(g)"; aView.Columns["pf_yf_bh"].OptionsColumn.AllowEdit = false; aView.Columns["pf_yf_sl"].OptionsColumn.AllowEdit = false; aView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFullFocus; aView.BestFitColumns(); } }
void dgvHistoryChat_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView dgvMain = sender as DevExpress.XtraGrid.Views.Grid.GridView; DevExpress.XtraGrid.Views.Grid.GridView detailView = dgvMain.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView; detailView.OptionsView.ShowColumnHeaders = false; detailView.OptionsView.RowAutoHeight = true; detailView.Appearance.Row.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; detailView.Columns["Body"].ColumnEdit = this.repositoryItemMemoEdit1; detailView.Columns["Date"].Visible = false; detailView.Columns["DateTime"].Visible = false; detailView.Columns["PIC"].Width = 100; detailView.Columns["Time"].Width = 100; }
private void gridViewDoki_MasterRowCollapsed(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e) { try { var view = (sender as DevExpress.XtraGrid.Views.Grid.GridView); int dataSourceRowIndex = view.GetDataSourceRowIndex(e.RowHandle); if (expanded_master_rows_doki.Where(x => x.Equals(dataSourceRowIndex)).ToList().Count > 0) { expanded_master_rows_doki.Remove(dataSourceRowIndex); } } catch (Exception ex) { log.Error(ex.Message); log.Error(ex.InnerException.Message); } }