To reproduce: use the following code snippet:
Sub New()
InitializeComponent()
Dim view As New ColumnGroupsViewDefinition()
view.ColumnGroups.Add(New GridViewColumnGroup("Customer Contact"))
view.ColumnGroups.Add(New GridViewColumnGroup("Details"))
view.ColumnGroups(1).Groups.Add(New GridViewColumnGroup("Address"))
view.ColumnGroups(1).Groups.Add(New GridViewColumnGroup("Contact"))
view.ColumnGroups(0).Rows.Add(New GridViewColumnGroupRow())
view.ColumnGroups(0).Rows(0).ColumnNames.Add("CompanyName")
view.ColumnGroups(0).Rows(0).ColumnNames.Add("ContactName")
view.ColumnGroups(0).Rows(0).ColumnNames.Add("ContactTitle")
view.ColumnGroups(1).Groups(0).Rows.Add(New GridViewColumnGroupRow())
view.ColumnGroups(1).Groups(0).Rows(0).ColumnNames.Add("Address")
view.ColumnGroups(1).Groups(0).Rows(0).ColumnNames.Add("City")
view.ColumnGroups(1).Groups(0).Rows(0).ColumnNames.Add("Country")
view.ColumnGroups(1).Groups(1).Rows.Add(New GridViewColumnGroupRow())
view.ColumnGroups(1).Groups(1).Rows(0).ColumnNames.Add("Phone")
view.ColumnGroups(1).Groups(1).Rows(0).ColumnNames.Add("Fax")
RadGridView1.ViewDefinition = view
End Sub
Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.CustomersTableAdapter.Fill(Me.NwindDataSet.Customers)
Me.RadGridView1.BestFitColumns(BestFitColumnMode.AllCells)
RadGridView1.Columns("Fax").IsVisible = False
RadGridView1.Columns("Phone").IsVisible = False
Dim spreadExporter As GridViewSpreadExport = New GridViewSpreadExport(Me.RadGridView1)
Dim exportRenderer As New SpreadExportRenderer()
spreadExporter.HiddenColumnOption = Export.HiddenOption.ExportAsHidden
spreadExporter.FreezeHeaderRow = True
spreadExporter.ExportGroupedColumns = True
spreadExporter.ExportChildRowsGrouped = True
spreadExporter.ExportVisualSettings = True
spreadExporter.ExportHierarchy = True
spreadExporter.ExportViewDefinition = True
spreadExporter.ExportFormat = SpreadExportFormat.Xlsx
Dim fileName = "..\..\export" & DateTime.Now.ToLongTimeString().Replace(":", "_") & ".xlsx"
spreadExporter.RunExport(fileName, exportRenderer)
Process.Start(fileName)
End Sub
Workaround: instead of hiding all the columns inside a group, hide the entire group:
Sub New()
InitializeComponent()
Dim view As New ColumnGroupsViewDefinition()
view.ColumnGroups.Add(New GridViewColumnGroup("Customer Contact"))
view.ColumnGroups.Add(New GridViewColumnGroup("Details"))
view.ColumnGroups(1).Groups.Add(New GridViewColumnGroup("Address"))
view.ColumnGroups(1).Groups.Add(New GridViewColumnGroup("Contact"))
view.ColumnGroups(0).Rows.Add(New GridViewColumnGroupRow())
view.ColumnGroups(0).Rows(0).ColumnNames.Add("CompanyName")
view.ColumnGroups(0).Rows(0).ColumnNames.Add("ContactName")
view.ColumnGroups(0).Rows(0).ColumnNames.Add("ContactTitle")
view.ColumnGroups(1).Groups(0).Rows.Add(New GridViewColumnGroupRow())
view.ColumnGroups(1).Groups(0).Rows(0).ColumnNames.Add("Address")
view.ColumnGroups(1).Groups(0).Rows(0).ColumnNames.Add("City")
view.ColumnGroups(1).Groups(0).Rows(0).ColumnNames.Add("Country")
view.ColumnGroups(1).Groups(1).Rows.Add(New GridViewColumnGroupRow())
view.ColumnGroups(1).Groups(1).Rows(0).ColumnNames.Add("Phone")
view.ColumnGroups(1).Groups(1).Rows(0).ColumnNames.Add("Fax")
RadGridView1.ViewDefinition = view
view.ColumnGroups(1).Groups.Last().IsVisible=False
End Sub
To reproduce: Initially, the row at index 0 is white, when you move it to index 5 it is still white until you hover it:
public RadForm1()
{
InitializeComponent();
this.radGridView1.Columns.Add("Data");
for (int i = 0; i < 100; i++)
{
this.radGridView1.Rows.Add(i);
}
this.radGridView1.EnableAlternatingRowColor = true;
this.radGridView1.TableElement.AlternatingRowColor = Color.Aqua;
}
private void radButton1_Click(object sender, EventArgs e)
{
this.radGridView1.Rows.Move(0, 5);
}
Workaround:
private void radButton1_Click(object sender, EventArgs e)
{
this.radGridView1.Rows.Move(0, 5);
this.radGridView1.Rows[5].InvalidateRow();
}
This was working this way in 2017 then we changer it so all rows are affected. Bot modes should be supported.
I have the following logic for my View, which has a RadGridView control (add to form at design-time).
GUI is a lightweight view, Controller does the heavy lifting. That part is all good.
However setting the column name and column autosize stuff is a little more "over-complicated" than I'd wish to see. It all works though.
Would be nice to have a "GridViewTextBoxColumnAttribute" as per below, for properties on Custom datasource objects to achieve the same thing in a more concise way.
Or am I missing something and there is a much easier way to do what I want?
I have a number of datasource classes: MyObject, MyCar, MyDog, MyWhatever... that ALL have different property names and datatypes, but may or may-not have the same column name or MasterTemplate style.
Also BestFitColumns is a function of the MasterTemplate, would be nice if it were a property for consistency sake (call to internal function encapsulated in the Set etc), as from a Telerik user's perspective it's just an enum. Then it would be setable in the SmartTag window as well, as functions can't be assigned to.
public partial class RadForm1 : Telerik.WinControls.UI.RadForm, IView
{
public RadForm1)
{
InitializeComponent();
}
private void RadForm1_Load(object sender, EventArgs e)
{
var x = new Controller();
x.SetTemplate(this);
}
public Telerik.WinControls.UI.RadGridView RadGridView()
{
return this.radGridView1;
}
}
public class Controller
{
public void SetTemplate(IView view)
{
var View_RadGrid = view.RadGridView();
View_RadGrid.MasterTemplate.AutoGenerateColumns = false;
View_RadGrid.MasterTemplate.AutoGenerateHierarchy = false;
View_RadGrid.MasterTemplate.AllowColumnResize = false;
View_RadGrid.MasterTemplate.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells);
var cols = new List<Telerik.WinControls.UI.GridViewDataColumn>()
{
new Telerik.WinControls.UI.GridViewTextBoxColumn("DisplayName1"),
new Telerik.WinControls.UI.GridViewTextBoxColumn("DisplayName2")
};
View_RadGrid.MasterTemplate.Columns.AddRange(cols.ToArray());
View_RadGrid.DataSource = new List<MyObject>()
{
new MyObject() { DisplayName1 = "1", DisplayName2 = "2" },
new MyObject() { DisplayName1 = "3", DisplayName2 = "4" }
};
}
private class MyObject
{
[GridViewTextBoxColumnAttribute("DisplayName1", BestFitColumn = Telerik.WinControls.UI.BestFitColumnMode.AllCells, AllowColumnResize = false)]
public string DisplayName1 { get; set; }
[GridViewTextBoxColumnAttribute("DisplayName2", BestFitColumn = Telerik.WinControls.UI.BestFitColumnMode.AllCells, AllowColumnResize = false)]
public string DisplayName2 { get; set; }
}
}
public interface IView
{
Telerik.WinControls.UI.RadGridView RadGridView();
}
[System.AttributeUsage(System.AttributeTargets.Property)]
public class GridViewTextBoxColumnAttribute : System.Attribute
{
private string FieldName;
public Telerik.WinControls.UI.BestFitColumnMode BestFitColumn;
public bool AllowColumnResize;
public GridViewTextBoxColumnAttribute(string fieldName)
{
this.FieldName = fieldName;
}
}Steps to reproduce:
When the grid is loaded and displayed, a NullReferenceException will be thrown:
Message : Object reference not set to an instance of an object.
Type : System.NullReferenceException
Source : Telerik.WinControls.GridView
Stack trace : Telerik.WinControls.UI.BestFitHelper.SetColumnWidth(GridViewColumn column, Single desiredWidth)
Telerik.WinControls.UI.BestFitHelper.BestFitColumnCore(GridViewColumn column, BestFitColumnMode mode)
Telerik.WinControls.UI.BestFitHelper.ProcessRequests()
Telerik.WinControls.UI.RowsContainerElement.MeasureOverride(SizeF availableSize)
Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
Telerik.WinControls.RadElement.Measure(SizeF availableSize)
Telerik.WinControls.UI.ScrollViewElement`1.MeasureViewElement(SizeF availableSize)
Telerik.WinControls.UI.ScrollViewElement`1.MeasureView(SizeF availableSize)
Telerik.WinControls.UI.ScrollViewElement`1.MeasureOverride(SizeF availableSize)
Telerik.WinControls.UI.GridTableElement.MeasureOverride(SizeF availableSize)
Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
Telerik.WinControls.RadElement.Measure(SizeF availableSize)
Telerik.WinControls.Layouts.DockLayoutPanel.MeasureOverride(SizeF constraint)
Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
Telerik.WinControls.RadElement.Measure(SizeF availableSize)
Telerik.WinControls.UI.LightVisualElement.MeasureElements(SizeF availableSize, SizeF clientSize, Padding borderThickness)
Telerik.WinControls.UI.LightVisualElement.MeasureOverride(SizeF availableSize)
Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
Telerik.WinControls.RadElement.Measure(SizeF availableSize)
Telerik.WinControls.RootRadElement.MeasureOverride(SizeF availableSize)
Telerik.WinControls.RootRadElement.MeasureCore(SizeF availableSize)
Telerik.WinControls.RadElement.Measure(SizeF availableSize)
Telerik.WinControls.RadElementTree.PerformInnerLayout(Boolean performMeasure, Int32 x, Int32 y, Int32 width, Int32 height)
Telerik.WinControls.RadControl.OnLoad(Size desiredSize)
Telerik.WinControls.UI.RadGridView.OnLoad(Size desiredSize)
Telerik.WinControls.RadControl.LoadElementTree(Size desiredSize)
Telerik.WinControls.RadControl.OnCreateControl()
System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
System.Windows.Forms.Control.CreateControl()
System.Windows.Forms.Control.SetVisibleCore(Boolean value)
Telerik.WinControls.UI.TabPanel.set_Visible(Boolean value)
Telerik.WinControls.UI.TabStripPanel.SetSelected(TabPanel tabPanel)
Telerik.WinControls.UI.TabStripPanel.UpdateTabSelection(Boolean updateFocus)
Telerik.WinControls.UI.Docking.DockTabStrip.UpdateTabSelection(Boolean updateFocus)
Telerik.WinControls.UI.Docking.ToolTabStrip.UpdateTabSelection(Boolean updateFocus)
Telerik.WinControls.UI.TabStripPanel.OnHandleCreated(EventArgs e)
System.Windows.Forms.Control.WmCreate(Message& m)
System.Windows.Forms.Control.WndProc(Message& m)
System.Windows.Forms.ScrollableControl.WndProc(Message& m)
Telerik.WinControls.RadControl.WndProc(Message& m)
Telerik.WinControls.UI.SplitPanel.WndProc(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)Dears
Looks like after last Telerik update to 2019.1.117.40 lilter do digits/numbers is not working any more. When I'd like filter out on decimal columns (or even text column but with linked decimal/int values) I get no results, no rows.
With text columns all is ok.
BR
To reproduce:
Update the data source directly and check the OldItems array.
When you start typing in the search text box some long text, not all key strokes will be handled. Please refer to the attached gifs file illustrating the behavior in the previous version and the latest release.
Please refer to the attached sample project. Run the project and try typing "too long to type" in as your search.
To reproduce:
- Add items with the same display member open the drop-down and select the second.
- Select another control on the form and then reopen the popup.
- The first item is selected.
Workaround:
class MyMultiColumnComboBox : RadMultiColumnComboBox
The function OnNotifyPropertyChanged(string propertyName) in RadGridView.cs does not call the base function of RadControl.
RadGridView.cs
protected override void OnNotifyPropertyChanged(string propertyName)
{
if (propertyName == "AutoSize")
{
if (!this.AutoSize)
{
this.RootElement.StretchHorizontally = true;
this.RootElement.StretchVertically = true;
}
else
{
this.RootElement.StretchHorizontally = false;
this.RootElement.StretchVertically = false;
}
}
}
RadControl.cs
/// <summary>
/// Raises the PropertyChanged event
/// </summary>
/// <param name="propertyName">The name of the property</param>
protected virtual void OnNotifyPropertyChanged(string propertyName)
{
this.OnNotifyPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
{
PropertyChangedEventHandler handler1 =
(PropertyChangedEventHandler)this.Events[RadControl.PropertyChangedEventKey];
if (handler1 != null)
{
handler1(this, e);
}
}
Because of this i cannot do the following
RadGridView grid = new RadGridView();
grid.OnNotifyPropertyChanged("mypropertyname");
I currently work around this by doing the following
RadGridView grid = new RadGridView();
grid.OnNotifyPropertyChanged(new PropertyChangedEventArgs("mypropertyname"));
I need this functionality because i have a custom control which is derived from RadGridView and it has a custom property that requires databinding with INotifyPropertyChanged. I cannot implement this interface myself because the grid already does this.
I have checked this in both the 2018.1.220 and 2019.1.219 source.
Kind regards,
Edwin Dirkzwager
CIP Software
Please run the attached sample project and try to expand a row. The following error occurs:
System.NullReferenceException was unhandled by user code
To reproduce:
- Set the AutoSize to true
- Add GroupDescriptor
- An InvalidOperationException is thrown
In my gridview need support of different heights of rows. I solved it with the autosize property.
But now I have a side action that the header row and filter row also react to the autosize property.
Attached you can see this behaviour...
Here my code:
Grid.MasterView.TableFilteringRow.MinHeight = 40
Grid.AutoSizeRows = True
Is there a chance to separate data rows from filter and header row?
Regards,
Dimitri