public ShowSynonymReport(IList <SynonymReportItem> items) { Text = "Отчет о сопоставлениях"; report = new VirtualTable(new TemplateManager <SynonymReportItem>( () => { var row = new Row(); var widths = WidthHolder.ReportWidths; var header = new Header("Пользователь").Sortable("User"); header.InlineStyle.Set(StyleElementType.Width, widths[0]); row.Append(header); header = new Header("Прайс").Sortable("Price"); header.InlineStyle.Set(StyleElementType.Width, widths[1]); row.Append(header); header = new Header("Регион").Sortable("Region"); header.InlineStyle.Set(StyleElementType.Width, widths[2]); row.Append(header); header = new Header("Синоним").Sortable("Synonym"); header.InlineStyle.Set(StyleElementType.Width, widths[3]); row.Append(header); header = new Header("Производитель").Sortable("Producer"); header.InlineStyle.Set(StyleElementType.Width, widths[4]); row.Append(header); header = new Header("Продукты").Sortable("Products"); header.InlineStyle.Set(StyleElementType.Width, widths[4]); row.Append(header); return(row); }, i => { var row = Row.Cells(i.User, i.Price, i.Region, i.Synonym, i.Producer, i.Products); if (i.IsSuspicious == 1) { row.AddClass("Suspicious"); } return(row); })); report.CellSpacing = 1; report.RegisterBehavior(new ToolTipBehavior(), new ColumnResizeBehavior(), new SortInList(), new RowSelectionBehavior()); report.TemplateManager.Source = items.ToList(); report.Behavior <ColumnResizeBehavior>().ColumnResized += column => WidthHolder.Update(report, column, WidthHolder.ReportWidths); report.TemplateManager.ResetColumns(); report.Host .InputMap() .KeyDown(Keys.Space, Suspicios) .KeyDown(Keys.Delete, Delete) .KeyDown(Keys.F11, Reload); Controls.Add(report.Host); var toolBar = new ToolStrip(); Controls.Add(toolBar); var begin = DateTime.Now.AddDays(-1).Date; var end = DateTime.Now.Date; var beginPeriodCalendar = new DateTimePicker { Value = begin, Width = 130, }; var endPeriodCalendar = new DateTimePicker { Value = end, Width = 130, }; toolBar .Label("C") .Host(beginPeriodCalendar) .Label("По") .Host(endPeriodCalendar) .Button("Показать", () => Action(s => { lastBeginDate = beginPeriodCalendar.Value; lastEndDate = endPeriodCalendar.Value; report.TemplateManager.Source = s.ShowSynonymReport(beginPeriodCalendar.Value, endPeriodCalendar.Value).ToList(); })) .Separator() .Button("Suspicious", "Подозрительный (Пробел)", Suspicios) .Button("Удалить (Delete)", Delete) .Button("Обновить (F11)", Reload); MinimumSize = new Size(640, 480); KeyPreview = true; this.InputMap().KeyDown(Keys.Escape, Close); report.Behavior <IRowSelectionBehavior>().SelectedRowChanged += (oldIndex, newIndex) => { var item = report.Translate <SynonymReportItem>(report.ViewPort.GetRow(newIndex)); if (item.IsSuspicious == 0) { toolBar.Items["Suspicious"].Text = "Подозрительный (Пробел)"; } else { toolBar.Items["Suspicious"].Text = "Не подозрительный (Пробел)"; } }; }