Completed
Last Updated: 23 Apr 2014 12:56 by ADMIN
ADMIN
Alexander
Created on: 18 Nov 2010 04:13
Category: GridView
Type: Feature Request
1
IMPROVE. Add customization options for the ConditionalFormatting form
Provide options for customization of the columns RadComboBox items.
Added new event in the RadGridView control ConditionalFormattingFormShown fired when the conditionalformattingform is shown.
Added new customization options to ConditionalFormattingForm dialog:
property: SelectFromVisibleColumnsOnly - filter the column selector to display only visible columns in RadGridView
property: ColumnDisplayStyle - display Name or HeaderText or both in column selector
Example:
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace Lab.Grid
{
public partial class GridConditionalFormattingForm : Form
{
private RadGridView gridView = new RadGridView();
public GridConditionalFormattingForm()
{
InitializeComponent();
gridView.Dock = DockStyle.Fill;
gridView.Parent = this;
gridView.MultiSelect = true;
gridView.ConditionalFormattingFormShown += gridView_ConditionalFormattingFormShown;
}
void gridView_ConditionalFormattingFormShown(object sender, System.EventArgs e)
{
ConditionalFormattingForm form = sender as ConditionalFormattingForm;
form.ColumnDisplayStyle = ColumnDisplayStyle.Name | ColumnDisplayStyle.HeaderText;
form.SelectFromVisibleColumnsOnly = true;
}
protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e);
DataTable data = new DataTable();
data.Columns.Add("ID");
data.Columns.Add("Name");
data.Columns.Add("Test3");
data.Rows.Add(1, "Name1", "Test1");
data.Rows.Add(2, "Name2", "Test2");
data.Rows.Add(1, "Name3", "Test3");
data.Rows.Add(4, "Name4", "Test4");
data.Rows.Add(1, "Name5", "Test5");
gridView.DataSource = data;
gridView.Columns[2].IsVisible = false;
gridView.Columns[2].HeaderText = "AlaBala";
ConditionalFormattingObject format = new ConditionalFormattingObject("MyCondition", ConditionTypes.Equal, "1", "", true);
format.CellBackColor = Color.Red;
format.ApplyOnSelectedRows = false;
gridView.Columns[0].HeaderText = "FirstName";
gridView.Columns[0].ConditionalFormattingObjectList.Add(format);
}
}
}
0 comments