I want my grid to fill to the full available size. I also don't want the user to be able to adjust the column widths. There is a bug in the grid that does not allow both of these features.
If you try the sample code below, you will see that the grid automatically fills to the available size. Then uncomment out the two "AllowResize" lines and you will see that the grid no longer automatically fills to the available size.
Is there a way to both fill and prevent the user from resizing the grid columns? THANKS
If you try the sample code below, you will see that the grid automatically fills to the available size. Then uncomment out the two "AllowResize" lines and you will see that the grid no longer automatically fills to the available size.
Is there a way to both fill and prevent the user from resizing the grid columns? THANKS
Imports Telerik.WinControls.UI
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim people As New List(Of Person) From {New Person(1, "Richard"), New Person(2, "Peter"), New Person(3, "Chris")}
Me.radgridview1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
Dim column1 As New GridViewTextBoxColumn("Column 1")
'column1.AllowResize = False
Dim column2 As New GridViewComboBoxColumn("Column 2")
column2.Width = 100
column2.FieldName = "Id"
column2.DataSource = people
column2.DisplayMember = "Name"
column2.ValueMember = "Id"
'column2.AllowResize = False
Me.radgridview1.Columns.Add(column1)
Me.radgridview1.Columns.Add(column2)
' Populate the cells
Dim rowInfo As GridViewRowInfo = Me.radgridview1.Rows.AddNew()
rowInfo.Cells(0).Value = "A1"
rowInfo.Cells(1).Value = 1
rowInfo = Me.radgridview1.Rows.AddNew()
rowInfo.Cells("A").Value = "A2"
rowInfo.Cells("B").Value = 2
End Sub
End Class
Public Class Person
Public Sub New(ByVal Id As Integer, ByVal Name As String)
Me.Name = Name
Me.Id = Id
End Sub
Public Property Name As String
Public Property Id As Integer
End Class