Hello, I made a Master Detail grid in a NET5 WinForms application, like this:
sfDataGrid9.AutoGenerateColumns = false;
sfDataGrid9.Columns.Add(new GridCheckBoxColumn() { MappingName = "Selected", HeaderText = "" });
sfDataGrid9.Columns.Add(new GridTextColumn() { MappingName = "Codice", HeaderText = "Codice" });
sfDataGrid9.Columns.Add(new GridTextColumn() { MappingName = "Nome", HeaderText = "Nome" });
sfDataGrid9.Columns.Add(new GridDateTimeColumn() { MappingName =
"DataInizio", HeaderText = "Data inizio", NullDisplayText = "" });
sfDataGrid9.AddNewRowPosition = RowPosition.None;
sfDataGrid9.AutoSizeColumnsMode = AutoSizeColumnsMode.Fill;
GridViewDefinition specieDetailsView = new GridViewDefinition();
specieDetailsView.RelationalColumn = "SpecieDetails";
SfDataGrid specieGrid = new SfDataGrid();
specieGrid.AutoGenerateColumns = false;
specieGrid.AllowSorting = false;
specieGrid.Columns.Add(new GridCheckBoxColumn() { MappingName = "Selected", HeaderText = "", AllowEditing = true });
specieGrid.Columns.Add(new GridTextColumn() { MappingName =
"TipoSpecieDesc", HeaderText = "Specie", AllowEditing = false });
specieDetailsView.DataGrid = specieGrid;
sfDataGrid9.DetailsViewDefinitions.Add(specieDetailsView);
and it works fine, if the DataGrid is not docked
If I just set its Dock property to Fill (is inside a panel), I receive the following error in Application.Run(new MainForm())
Once I revert the Dock to none, it works fine.
System.ArgumentOutOfRangeException: '4 out of range 0 to 3 Arg_ParamName_Name'
4 out of range 0 to 3 (Parameter 'to')
at Syncfusion.WinForms.GridCommon.ScrollAxis.DistanceRangeCounterCollection.CheckRange(String paramName, Int32 from, Int32 to, Int32 actualValue)
at Syncfusion.WinForms.GridCommon.ScrollAxis.DistanceRangeCounterCollection.SetRange(Int32 from, Int32 to, Double distance)
at Syncfusion.WinForms.GridCommon.ScrollAxis.LineSizeCollection.InitializeDistances()
at Syncfusion.WinForms.GridCommon.ScrollAxis.LineSizeCollection.ResumeUpdates()
at Syncfusion.WinForms.DataGrid.AutoSizeController.Refresh()
at Syncfusion.WinForms.DataGrid.TableControl.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
at System.Windows.Forms.Layout.DefaultLayout.TryCalculatePreferredSizeDockedControl(IArrangedElement element, Rectangle newElementBounds, Boolean measureOnly, Size& preferredSize, Rectangle& remainingBounds)
at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedControls(IArrangedElement container, Boolean measureOnly)
at System.Windows.Forms.Layout.DefaultLayout.TryCalculatePreferredSize(IArrangedElement container, Boolean measureOnly, Size& preferredSize)
at System.Windows.Forms.Layout.DefaultLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at Syncfusion.WinForms.DataGrid.SfDataGrid.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
Is there anything else I can do to Dock the grid to fill the Panel?
Thanks