本文整理汇总了C#中GridColumn类的典型用法代码示例。如果您正苦于以下问题:C# GridColumn类的具体用法?C# GridColumn怎么用?C# GridColumn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GridColumn类属于命名空间,在下文中一共展示了GridColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestGridFilterHeaderRenderer
public void TestGridFilterHeaderRenderer()
{
var settings = new QueryStringFilterSettings();
var renderer = new QueryStringFilterColumnHeaderRenderer(settings);
var column = new GridColumn<TestModel, string>(c => c.Title, new TestGrid(Enumerable.Empty<TestModel>()));
var htmlstring = renderer.Render(column);
Assert.IsNotNull(htmlstring);
var html = htmlstring.ToHtmlString();
Assert.IsTrue(string.IsNullOrEmpty(html));
column.Filterable(true);
htmlstring = renderer.Render(column);
Assert.IsNotNull(htmlstring);
html = htmlstring.ToHtmlString();
Assert.IsTrue(!string.IsNullOrWhiteSpace(html));
Assert.IsTrue(html.Contains("data-filterdata="));
Assert.IsTrue(html.Contains("class=\"grid-filter\""));
Assert.IsTrue(html.Contains("class=\"grid-filter-btn\""));
Assert.IsTrue(html.Contains("data-widgetdata="));
}
示例2: UpdateDatasource
protected override DataTable UpdateDatasource(DataTable dtSource)
{
dtSource.DefaultView.RowFilter = GroupTypeEqualExpression(SummaryRow);
var dtAvgView = dtSource.DefaultView.ToTable().DefaultView;
dtAvgView.Sort = "rate desc";
dtSource.DefaultView.RowFilter = "";
var dtRpt = dtSource.DefaultView.ToTable(true,ColGroupType, ColTimeband);
dtRpt.PrimaryKey = new[] {dtRpt.Columns[ColGroupType], dtRpt.Columns[ColTimeband] };
int index = 1;
foreach (DataRowView row in dtAvgView)
{
var idKenh = row["KENH_PHAT"];
dtSource.DefaultView.RowFilter = "KENH_PHAT=" + idKenh;
var dtByKenh = dtSource.DefaultView.ToTable(true,ColGroupType, ColTimeband, "RATE");
var fiedName = "RATE_" + idKenh;
dtByKenh.Columns["RATE"].ColumnName = fiedName;
dtRpt.Merge(dtByKenh);
var col = new GridColumn
{
Name = "ColRate_" + idKenh,
Caption = row["KENH_PHAT_NAME"].ToString(),
Visible = true
};
GridViewDetail.Columns.Add(col);
HelpGridColumn.CotCalcEdit(col, fiedName, 1);
col.OptionsColumn.AllowMove = false;
col.OptionsColumn.AllowSort = DefaultBoolean.False;
col.VisibleIndex = index;
index++;
}
var dss = new DataSet();
dss.Tables.Add(dtRpt);
return dtRpt;
}
示例3: CotCalcEditDec
public static RepositoryItemCalcEdit CotCalcEditDec(GridColumn Column, string ColumnField, int SoThapPhan, decimal Min, decimal Max, bool AllowNULL)
{
RepositoryItemCalcEdit repos = CotCalcEditInt(Column, ColumnField, Min, Max, AllowNULL);
ApplyFormatAction.applyElement(repos, SoThapPhan);
HelpGridColumn.SetSummaryNumFormat(Column, SoThapPhan);
return repos;
}
示例4: AddCalc
/// <summary>Hàm này chỉ dùng khi cột tính toán chỉ cần hiển thị không có lưu trữ
/// </summary>
public static void AddCalc(GridView gridView, ref GridColumn ResultColumn, string[] FieldNames, ProtocolVN.Framework.Win.RowInteraction.GridColumnFunction func)
{
RowInteraction grid = new RowInteraction(gridView);
gridView.CustomUnboundColumnData += new DevExpress.XtraGrid.Views.Base.CustomColumnDataEventHandler(grid.gridView_CustomUnboundColumnDataCalc);
ResultColumn.UnboundType = DevExpress.Data.UnboundColumnType.Object;
grid.AddCalcHelp(null, ResultColumn, FieldNames, func);
}
示例5: AddCalcGridColum
/// <summary>Phương thức cho phép thêm chức năng vào cho Cột
/// Khi thay đổi giá trị của cột nó làm ảnh hưởng giá trị của các
/// cột khác
/// </summary>
/// <param name="Column">Cột mã hàng</param>
/// <param name="FieldName">FieldName của Tên hàng hóa, đơn giá, giảm giá ...</param>
/// <param name="func">Hàm gán giá trị cho các field</param>
public static void AddCalcGridColum(GridView Grid, GridColumn Column, string[] FieldNames, GetInfo Func)
{
Grid.CellValueChanged += delegate(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
{
try
{
GridView grid = (GridView)sender;
DataRow row = grid.GetDataRow(grid.FocusedRowHandle);
if (e.Column.FieldName.Equals(Column.FieldName))
{
object[] Values = Func(row[Column.FieldName]);
if (Values != null)
{
for (int i = 0; i < FieldNames.Length; i++)
{
grid.SetRowCellValue(grid.FocusedRowHandle, FieldNames[i], Values[i]);
}
}
else
{
grid.DeleteRow(grid.FocusedRowHandle);
}
}
}
catch (Exception ex)
{
PLException.AddException(ex);
}
};
}
示例6: CalcSummaryRect
private static Rectangle CalcSummaryRect(string text, RowObjectCustomDrawEventArgs e, GridColumn column)
{
var gridInfo = column.View.GetViewInfo() as GridViewInfo;
var result = GetColumnBounds(column);
SizeF sz = TextUtils.GetStringSize(e.Graphics, text, e.Appearance.Font);
var width = Convert.ToInt32(sz.Width) + 1;
if (!gridInfo.ViewRects.FixedLeft.IsEmpty)
{
var fixedLeftRight = gridInfo.ViewRects.FixedLeft.Right;
var marginLeft = result.Right - width - fixedLeftRight;
if (marginLeft < 0 && column.Fixed == FixedStyle.None)
return Rectangle.Empty;
}
if (!gridInfo.ViewRects.FixedRight.IsEmpty)
{
var fixedRightLeft = gridInfo.ViewRects.FixedRight.Left;
if (fixedRightLeft <= result.Right && column.Fixed == FixedStyle.None)
return Rectangle.Empty;
}
result = FixLeftEdge(width, result);
result.Width = result.Width;
result.Y = e.Bounds.Y;
result.Height = e.Bounds.Height - 2;
return PreventSummaryTextOverlapping(e, result);
}
示例7: GenerateTable
public Table GenerateTable(List<string> colwidths, List<string> headers)
{
this.colwidths = colwidths;
Table table1 = new Table();
TableProperties tableProperties1 = new TableProperties();
TableWidth tableWidth1 = new TableWidth() { Width = "8750", Type = TableWidthUnitValues.Dxa };
TableLayout tableLayout1 = new TableLayout() { Type = TableLayoutValues.Fixed };
TableIndentation tableIndentation1 = new TableIndentation() { Width = 108, Type = TableWidthUnitValues.Dxa };
TableLook tableLook1 = new TableLook() { Val = "04A0" };
tableProperties1.Append(tableWidth1);
tableProperties1.Append(tableIndentation1);
tableProperties1.Append(tableLayout1);
tableProperties1.Append(tableLook1);
TableGrid tableGrid1 = new TableGrid();
GridColumn gridColumn;
foreach (string cw in colwidths) {
gridColumn = new GridColumn() { Width = cw };
tableGrid1.Append(gridColumn);
}
TableRow headerRow = generateHeaderRow(headers);
table1.Append(tableProperties1);
table1.Append(tableGrid1);
table1.Append(headerRow);
return table1;
}
示例8: Should_map_the_constructor_parameters_to_the_right_properties
public void Should_map_the_constructor_parameters_to_the_right_properties()
{
var rows = new List<string>
{
"Row1",
"Row2"
};
const GridColumnType gridColumnType = GridColumnType.Sortable;
const string columnheader = "ColumnHeader";
const string fieldname = "FieldName";
var left = AlignAttribute.Left;
const string actionname = "ActionName";
IGridColumn gridColumn = new GridColumn(gridColumnType, columnheader, fieldname, left, true, false, "", actionname, rows);
gridColumn.Type.ShouldBeEqualTo(gridColumnType);
gridColumn.ColumnHeader.ShouldBeEqualTo(columnheader);
gridColumn.FieldName.ShouldBeEqualTo(fieldname);
gridColumn.Align.ShouldBeEqualTo(left);
gridColumn.IsDefaultSortColumn.ShouldBeTrue();
gridColumn.IsClientSideSortable.ShouldBeFalse();
gridColumn.ActionName.ShouldBeEqualTo(actionname);
gridColumn.Count.ShouldBeEqualTo(rows.Count);
gridColumn[0].ShouldBeEqualTo(rows[0]);
gridColumn[1].ShouldBeEqualTo(rows[1]);
}
示例9: SetGridColumnColourMessage
/// <summary>
/// Initialises a new instance of the <see cref="SetGridColumnColourMessage"/> class.
/// </summary>
/// <param name="driverId">The Id of the driver the message is related to.</param>
/// <param name="column">The column whose value is to be set.</param>
/// <param name="colour">The column colour value.</param>
public SetGridColumnColourMessage(int driverId, GridColumn column,
GridColumnColour colour)
: base(driverId)
{
Column = column;
Colour = colour;
}
示例10: InitColumnMaster
public override void InitColumnMaster()
{
XtraGridSupportExt.TextLeftColumn(Cotloai_cv, "TEN_CV");
XtraGridSupportExt.TextLeftColumn(CotCTCCV_ID, "CTCCV_ID");
XtraGridSupportExt.TextLeftColumn(Cotmota, "MO_TA");
HelpGridColumn.CotPLTimeEdit(Cotthoigian, "THOI_GIAN_THUC_HIEN", PLConst.FORMAT_TIME_HH_MM);
HelpGridColumn.CotPLTimeEdit(cotngaylamviec, "NGAY_LAM_VIEC", "ddd, dd/MM/yyyy");
HelpGridColumn.CotReadOnlyDate(CotNgaycapnhat, "NGAY_CAP_NHAT", PLConst.FORMAT_DATETIME_STRING);
XtraGridSupportExt.TextLeftColumn(cotnhanvien, "NHANVIEN");
GridColumn column = new GridColumn();
//XtraGridSupportExt.CreateDuyetGridColumn(column);
this.gridViewMaster.Columns.Add(column);
this.cotnhanvien.Visible = false;
this.cotngaylamviec.Visible = false;
gridViewMaster.OptionsView.ShowGroupPanel = false;
//Nếu ngày cập nhật > ngày làm việc 1 ngày -> Đỏ
StyleFormatCondition condition = new StyleFormatCondition();
condition.Appearance.Options.UseForeColor = true;
condition.Appearance.ForeColor = Color.Red;
condition.Condition = FormatConditionEnum.Expression;
condition.Expression = string.Format(@"(AddDays(AddTimeSpan([NGAY_LAM_VIEC],#{0}#),1) <= [NGAY_CAP_NHAT])", new TimeSpan(0, 0, 1));
condition.ApplyToRow = true;
gridViewMaster.FormatConditions.Add(condition);
//-----------------------------
}
示例11: BindData
private void BindData()
{
_data.Clear();
_data.Add(_projectModel.FreqByDirs.ToArray());
_data.AddRange(_projectModel.FreqByBins);
_data.Add(_projectModel.MeanVelocityPerDir.ToArray());
grid.Columns.Clear();
var titleCol = new GridColumn();
titleCol.UnboundType = UnboundColumnType.String;
titleCol.ReadOnly = true;
titleCol.FieldName = String.Format("Title");
titleCol.Header = "#";
titleCol.Width = 70;
titleCol.Tag = -1;
grid.Columns.Add(titleCol);
for (var dirIdx = 0; dirIdx < _projectModel.NDirs; dirIdx++)
{
var col = new GridColumn();
col.UnboundType = UnboundColumnType.Decimal;
col.ReadOnly = true;
col.FieldName = String.Format("ColumnN{0}", dirIdx);
col.Header = String.Format("{0}", (360/_projectModel.NDirs)*dirIdx);
col.Tag = dirIdx;
col.Width = 70;
grid.Columns.Add(col);
}
grid.ItemsSource = null;
grid.ItemsSource = _data;
}
示例12: SetGridColumnValueMessage
/// <summary>
/// Initialises a new instance of the <see cref="SetGridColumnValueMessage"/> class.
/// </summary>
/// <param name="driverId">The Id of the driver the message is related to.</param>
/// <param name="column">The column whose value is to be set.</param>
/// <param name="colour">The column colour value.</param>
/// <param name="value">The column value.</param>
public SetGridColumnValueMessage(int driverId, GridColumn column,
GridColumnColour colour, string value)
: base(driverId)
{
Column = column;
Colour = colour;
Value = value;
}
示例13: HideGroupCalcInfo
/// <summary>
/// Ẩn thông tin tính toán của 1 nhóm trên Grid
/// </summary>
/// <param name="grid">GridView</param>
/// <param name="column">GridColumn</param>
public static void HideGroupCalcInfo(GridView grid, GridColumn column)
{
if (column.SummaryItem != null)
{
column.UnGroup();
grid.GroupSummary.Remove(column.SummaryItem);
}
}
示例14: CotCalcEdit
public static RepositoryItemCalcEdit CotCalcEdit(GridColumn Column, string ColumnField, int SoThapPhan)
{
HelpGridColumn.SetHorzAlignment(Column, HorzAlignment.Far);
HelpGridColumn.SetSummaryNumFormat(Column, SoThapPhan);
Column.ColumnEdit = HelpRepository.GetCalcEdit(SoThapPhan);
if (ColumnField != null) Column.FieldName = ColumnField;
return (RepositoryItemCalcEdit)Column.ColumnEdit;
}
示例15: Assign
///<summary>Copies properties from another column to this instance.</summary>
protected override void Assign(GridColumn column)
{
base.Assign(column);
var col = column as SmartGridColumn;
if (col != null) {
ShowEditorOnMouseDown = col.ShowEditorOnMouseDown;
AllowKeyboardActivation = col.AllowKeyboardActivation;
}
}