To reproduce:
- Add a checkbox column to a grid
- Add the following code to the ValueChanged event:
void radGridView1_ValueChanged(object sender, EventArgs e)
{
if (radGridView1.CurrentColumn.Name == "BoolColumn")
{
To reproduce:
- add RadGridView and use the following code:
public Form1()
{
InitializeComponent();
List<ColorItem> list = new List<ColorItem>();
List<Color> colors = new List<Color>()
{
Color.Red,
Color.Black,
Color.Blue,
Color.Pink,
Color.Green,
Color.Yellow,
Color.Purple,
Color.Aqua,
Color.Orange,
Color.Fuchsia
};
for (int i = 0; i < 10; i++)
{
list.Add(new ColorItem(i, colors[i], colors[i].Name));
}
radGridView1.DataSource = list;
radGridView1.CellValidating += radGridView1_CellValidating;
}
private void radGridView1_CellValidating(object sender, CellValidatingEventArgs e)
{
if (e.ActiveEditor is GridColorPickerEditor && (Color)e.Value == Color.Aqua)
{
e.Cancel = true;
}
}
Steps:
1. Select the "Color" column of a certain cell and activate the editor;
2. Select Color.Aqua and press Tab to close the currently active GridColorPickerEditor;
As a result InvalidCastException is thrown.
Workaround: use a custom editor derivative of BaseGridEditor:
radGridView1.EditorRequired += radGridView1_EditorRequired;
private void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
{
if (e.EditorType == typeof(GridColorPickerEditor))
{
e.Editor = new CustomColorEditor();
}
}
public class CustomColorEditor : BaseGridEditor
{
TypeConverter converter = TypeDescriptor.GetConverter(typeof(Color));
protected override Telerik.WinControls.RadElement CreateEditorElement()
{
return new GridColorPickerElement();
}
public override object Value
{
get
{
GridColorPickerElement editorElement = this.EditorElement as GridColorPickerElement;
return editorElement.GetColorValue();
}
set
{
GridColorPickerElement editorElement = this.EditorElement as GridColorPickerElement;
if (value is Color)
{
editorElement.SetColorValue((Color)value);
}
else if (value is string)
{
editorElement.SetColorValue((Color)converter.ConvertFromString((string)value));
}
}
}
}
To reproduce:
- add RadGridView and use the following code:
public Form1()
{
InitializeComponent();
DataTable source = new DataTable();
string colName = string.Empty;
for (var i = 0; i < 10; i++)
{
colName = "col" + i.ToString();
this.Grid.Columns.Add(new GridViewTextBoxColumn(colName));
source.Columns.Add(new DataColumn(colName));
}
this.Grid.DataSource = source;
}
- Run the project, click over the grid and press PageUp key. As a result NullReferenceException is thrown.
Workaround: use custom BaseGridBehavior:
this.radGridView1.GridBehavior = new CustomGridBehavior();
public class CustomGridBehavior : BaseGridBehavior
{
protected override bool ProcessPageUpKey(KeyEventArgs keys)
{
GridTableElement tableElement = (GridTableElement)this.GridViewElement.CurrentView;
GridViewRowInfo firstScrollableRow = GetFirstScrollableRow(tableElement, true);
RadScrollBarElement scrollBar = tableElement.VScrollBar;
if (this.GridViewElement.CurrentRow == firstScrollableRow && firstScrollableRow!=null)
{
int height = (int)tableElement.RowScroller.ElementProvider.GetElementSize(firstScrollableRow).Height;
int newValue = scrollBar.Value - scrollBar.LargeChange + height + tableElement.RowScroller.ScrollOffset;
scrollBar.Value = Math.Max(newValue, scrollBar.Minimum);
tableElement.UpdateLayout();
firstScrollableRow = GetFirstScrollableRow(tableElement, false);
}
this.GridViewElement.Navigator.SelectRow(firstScrollableRow);
this.NavigateToPage(firstScrollableRow, keys.KeyData);
return true;
}
}
To reproduce:
-add RadGridView and apply Windows7 theme
-click on some GridHeaderCellElement. As a result the arrow is cut off.
Workaround:
this.radGridView1.ViewCellFormatting+=radGridView1_ViewCellFormatting;
private void radGridView1_ViewCellFormatting(object sender,
Telerik.WinControls.UI.CellFormattingEventArgs e)
{
GridHeaderCellElement cell = e.CellElement as GridHeaderCellElement;
if (cell != null)
{
cell.Arrow.Margin = new Padding(0, 3, 0, 0);
}
}
To reproduce:
-add RadGridView and enable excel-like filtering;
-apply Windows7 theme
When clicking on the filter button, the filter-dialog that shows is not really wide enough, it cuts the Cancel-button.
Workaround:
this.radGridView1.FilterPopupInitialized += radGridView1_FilterPopupInitialized;
private void radGridView1_FilterPopupInitialized(object sender,
Telerik.WinControls.UI.FilterPopupInitializedEventArgs e)
{
e.FilterPopup.PopupOpening -= FilterPopup_PopupOpening;
e.FilterPopup.PopupOpening += FilterPopup_PopupOpening;
}
private void FilterPopup_PopupOpening(object sender, CancelEventArgs args)
{
RadListFilterPopup popup = sender as RadListFilterPopup;
Padding currentPadding = popup.ButtonsMenuItem.Padding;
popup.ButtonsMenuItem.Padding = new Padding(currentPadding.Left,
currentPadding.Top, 20, currentPadding.Bottom);
}
To reproduce:
-add RadGridView and RadButton to the form;
-apply Office2010Black to the grid;
-use the following code:
private DataTable dataTable;
public Form1()
{
InitializeComponent();
radGridView1.AutoSizeRows = false;
radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
radGridView1.RowFormatting += radGridView1_RowFormatting;
radGridView1.ReadOnly = true;
radGridView1.ShowRowHeaderColumn = false;
radGridView1.VerticalScrollState = ScrollState.AlwaysShow;
radGridView1.ThemeName = "Office2010Black";
dataTable = new DataTable();
dataTable.Columns.Add("number", typeof(int));
dataTable.Columns.Add("descriptions", typeof(string));
radGridView1.DataSource = dataTable;
}
void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
e.RowElement.RowInfo.Height = 120;
}
private void radButton1_Click(object sender, EventArgs e)
{
radGridView1.Enabled = false;
Random rnd = new Random((int)DateTime.Now.Ticks);
dataTable.Clear();
for (int i = 0; i < rnd.Next(1000); i++)
{
DataRow row = dataTable.NewRow();
row[0] = i + 1;
row[1] = "description" + i.ToString();
dataTable.Rows.Add(row);
}
radGridView1.Enabled = true;
}
After clicking the button, notice that the vertical scroll bar is not painted correctly and it is resized when scrolling.
Workaround:
Update the button Click event as follows:
private void radButton1_Click(object sender, EventArgs e)
{
radGridView1.VerticalScrollState = ScrollState.AlwaysHide;
radGridView1.Enabled = false;
radGridView1.BeginEdit();
Random rnd = new Random((int)DateTime.Now.Ticks);
dataTable.Clear();
for (int i = 0; i < rnd.Next(1000); i++)
{
DataRow row = dataTable.NewRow();
row[0] = i + 1;
row[1] = "description" + i.ToString();
dataTable.Rows.Add(row);
}
radGridView1.EndEdit();
radGridView1.Enabled = true;
radGridView1.VerticalScrollState = ScrollState.AlwaysShow;
radGridView1.TableElement.VScrollBar.ResetLayout(true);
radGridView1.MasterTemplate.Refresh();
radGridView1.TableElement.ScrollToRow(radGridView1.CurrentRow);
}
I use a BindingList to bind our data to grid. But when I set to this list two classes with common interface but different implementation (override of baseclass virtual property), an data exception error is thrown. The same code works fine in previous versions.
After the delete, the item is removed from the BindingList, but it still appears in the RadGridView (or deleted a wrong item). The binding doesn't trigger the change in the UI/View.
FIX. RadGridView - cursor does not work properly, when cursor has value "Cursors.SizeWE" and mouse is moving over GroupPanelElement.
Steps to reproduce:
1. On a gridview make sure that a column in grouped.
2. Place your mouse on a column split just below the grouped column.
3. The cursor icon changes to a SizeWE icon to let you know that you can resize the column, This is normal.
4. Now, move the mouse (with the cursor icon = SizeWE) to the grouped column just above.
5. Now the cusor gets stucked with this SizeWE icon and never goes away on this grid. Wathever you do now the icon stays showing as a SizeWE icon.
Work Around - create custom grid behavior and override OnMouseMove method.
public class CustomGridBehavior : BaseGridBehavior
{
public override bool OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
GridTableElement table = this.GetGridTableElementAtPoint(e.Location);
if (table == null)
{
this.GridViewElement.ElementTree.Control.Cursor = Cursors.Default;
return false;
}
return false;
}
}
Steps to reproduce: 1. Addd a numeric (decimal) column to a grid 2. Enable filtering 3. Select 'Greater Than' filter 4. Enter '0' in the Spin Editor that appears You will see that no filtering occurs. Enter any other digit instead of 0 and filtering is performed.
We should consider the Display attribute when using business objects as data source in RadGridView.
The DefaultValueAttribute of Format and FormatInfo properties of GridViewDataColumn causes exceptions when load layout is performed. Comment: this is an issue inside .Net framework.
ADD. RadGridView - SelectLastAddedRow should work in scenarios when user adds row too, not only by adding rows from the datasource. Comment - the property is intended to work only for added rows in the RadGridView DataSource. For the rest of the cases, the cases, the UserAddedRow event should be handled.
Steps to reproduce: 1. Add a grid to a form and make it read only 2. Add a masked box column and set the mask 3. Add some data and run the project You will see that the mask is not applied to the values in the mask box column Comment: This is not an issue. The mask is applied after editing the text with RadMaskedEditBox, in read-only mode there is no masked editor created. You should use the conversion layer in RadGridView to solve the issue. Check the GridView >> Manipulated Data >> Convert Values example from our demo application.
Horizontal scroll bar should appear when auto size columns mode is enabled and columns has minimum width that cause the total width of the columns to be more that the visible area width.
Filtering in self-reference hierarchy should be performed over the rows from all levels
steps to reproduce: 1- Apply filter in a date column by choosing Between. 2- Leave default settings (change dates) and confirm 3- Save layout 4- Close the form 5- Open the form and load the layout forum: http://www.telerik.com/community/forums/winforms/gridview/save-load-layout-issue.aspx#1475412
Adding a column to the RadGridView datasouce (DataSet) does not reflect in RadGridView.
When you set the data source of the grid to null in self-reference hierarchy, the exception has been thrown.
steps to reproduce the bug: 1. run HtmlViewTest.exe 2. don't re-size the form (keep the horizontal scroll bar visible in grid) 3. keep editing column4 several times 4. System.NullReferenceException will be thrown