Hello Luca,
Thank you for writing.
In order to accomplish your task, you will need to best fit the columns first and calculate what the remaining space would be. Then you can adjust the width of the desired column according to your local setup. Please check my code snippet below:
public
partial
class
RadForm1 : Telerik.WinControls.UI.RadForm
{
public
RadForm1()
{
InitializeComponent();
this
.radGridView1.DataSource =
this
.GetData();
this
.radGridView1.BestFitColumns(BestFitColumnMode.AllCells);
}
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
int
desiredWidth =
this
.radGridView1.TableElement.Size.Width -
this
.radGridView1.TableElement.VisualRows[0].Size.Width -
this
.radGridView1.TableElement.VScrollBar.Size.Width;
this
.radGridView1.Columns[2].Width += desiredWidth;
this
.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
private
DataTable GetData()
{
DataTable dt =
new
DataTable();
dt.Columns.Add(
"Id"
,
typeof
(
int
));
dt.Columns.Add(
"Text"
,
typeof
(
string
));
dt.Columns.Add(
"IsChecked"
,
typeof
(
bool
));
dt.Columns.Add(
"DateTime"
,
typeof
(DateTime));
for
(
int
i = 0; i < 100; i++)
{
dt.Rows.Add(i,
"Text "
+ i, i % 2 == 0, DateTime.Now);
}
return
dt;
}
}
I am also attaching a short video showing the result on my end.
Regards,
Hristo
Progress Telerik