private void InitFlexGrid() { // setup flexgrid _flexGrid.AllowFiltering = true; _flexGrid.AllowFiltering = true; _flexGrid.AllowMerging = AllowMergingEnum.Nodes; _flexGrid.HideGroupedColumns = true; _flexGrid.ShowErrors = true; ColumnCollection columns = _flexGrid.Cols; // setup flexgrid columns columns[0].Width = 22; Column idColumn = columns["ID"]; idColumn.Width = 50; idColumn.AllowEditing = false; // setup combo list IEnumerable <string> products = (from s in _dataSet.Tables["Products"].Rows.Cast <DataRow>() select s) .Select(x => x["Name"].ToString()); columns["Product"].ComboList = string.Join("|", products); // build image map for countries var flagImageMap = new Dictionary <Country, Image>(); foreach (Country country in Enum.GetValues(typeof(Country))) { flagImageMap.Add(country, LoadImage(country.ToString())); } Column countryColumn = columns["Country"]; // assign image map to country column countryColumn.ImageMap = flagImageMap; countryColumn.ImageAndText = true; // build image map for colors var colorImageMap = new Dictionary <DrawColor, Image>(); foreach (DrawColor color in Enum.GetValues(typeof(DrawColor))) { colorImageMap.Add(color, LoadImage(color.ToString())); } Column colorColumn = columns["Color"]; // assign image map to color column colorColumn.ImageMap = colorImageMap; colorColumn.ImageAndText = true; Column priceColumn = columns["Price"]; priceColumn.Format = "C2"; priceColumn.TextAlign = TextAlignEnum.RightCenter; priceColumn.Width = 80; ValidationRuleCollection priceEditorValidation = _flexGrid.Cols["Price"].EditorValidation; // add validation rules priceEditorValidation.Add(new RequiredRule()); priceEditorValidation.Add(new RangeRule() { Minimum = decimal.Zero, Maximum = decimal.MaxValue, ErrorMessage = "Price cannot be negative" }); Column changeColumn = columns["Change"]; changeColumn.Format = "C2"; changeColumn.TextAlign = TextAlignEnum.RightCenter; Column historyColumn = columns["History"]; historyColumn.AllowEditing = false; // setup sparkline for history column historyColumn.ShowSparkline = true; Sparkline historySparkline = historyColumn.Sparkline; historySparkline.ShowLow = true; historySparkline.ShowHigh = true; Column discountColumn = columns["Discount"]; discountColumn.Format = "p0"; discountColumn.AllowEditing = false; discountColumn.Width = 80; Column ratingColumn = columns["Rating"]; ratingColumn.ImageAndText = false; ratingColumn.AllowEditing = false; columns["Active"].Width = 60; Column dateColumn = columns["Date"]; dateColumn.Format = "g"; // creating footers var footerDescription = new FooterDescription(); // price aggregate var priceAggregateDefinition = new AggregateDefinition() { Aggregate = AggregateEnum.Average, Caption = "Average price: ${0:N2}", PropertyName = "Price" }; // discount aggregate var discountAggregateDefinition = new AggregateDefinition { Aggregate = AggregateEnum.Average, Caption = "Average discount: {0:P}", PropertyName = "Discount" }; ObservableCollection <AggregateDefinition> aggregates = footerDescription.Aggregates; aggregates.Add(priceAggregateDefinition); aggregates.Add(discountAggregateDefinition); // add footers Footers footers = _flexGrid.Footers; footers.Descriptions.Add(footerDescription); footers.Fixed = true; // set details _flexGrid.RowDetailProvider = (g, r) => new CustomRowDetail(); // add red style CellStyle redStyle = _flexGrid.Styles.Add("Red"); redStyle.ImageAlign = ImageAlignEnum.LeftCenter; redStyle.ForeColor = Color.Red; // add green style CellStyle greenStyle = _flexGrid.Styles.Add("Green"); greenStyle.ImageAlign = ImageAlignEnum.LeftCenter; greenStyle.ForeColor = Color.Green; // add rating style CellStyle ratingStyle = _flexGrid.Styles.Add("Rating"); ratingStyle.ImageAlign = ImageAlignEnum.RightCenter; }