Hi,
What's the intended/best way of setting the location for RadGridView's ColumnChooser dialog box? I want to show it at the center of the calling application (ideally) or at least within the bounds of the calling application.
I tried using ColumnChooser.StartPosition = FormStartPosition.CenterParent but it didn't work. May be because its Parent or MdiParent is set to NULL (I found this while debugging).
Thus currently I am setting the DesktopLocation property of ColumnChooser to the DesktopLocation of ParentForm offset by (50, 50).
But I am bit apprehensive of ParentForm being NULL or this approach not working correctly for some reason. Thus needed to know if there exists a better way of specifying the location of the ColumnChooser.
Also, more importantly, I want the above code to work even if the user has more than one monitor/display unit.
Thanks,
~Abhay
What's the intended/best way of setting the location for RadGridView's ColumnChooser dialog box? I want to show it at the center of the calling application (ideally) or at least within the bounds of the calling application.
I tried using ColumnChooser.StartPosition = FormStartPosition.CenterParent but it didn't work. May be because its Parent or MdiParent is set to NULL (I found this while debugging).
Thus currently I am setting the DesktopLocation property of ColumnChooser to the DesktopLocation of ParentForm offset by (50, 50).
//Since workListRadGridView.ColumnChooser's Parent or MdiParent property is not set,
//setting its StartPosition to FormStartPosition.CenterParent doesn't work.
//As a workaround, get parent form's desktop location and offset it 50 pixels from
//both X and Y co-ordinates to keep the column chooser within the bounds of the application.
//Parent form desktop location.
//DesktopLocation property is idle choice because of the following remark in its documentation on MSDN:
//"If your application is running on a multimonitor system, the coordinates of the form are the coordinates for the combined desktop."
//Telerik's documentation for ColumnChooser also has the mention for DesktopLocation property.
//(though not in the context of "setting the location")
if (this.ParentForm != null
&& this.ParentForm.DesktopLocation != null)
{
Point columnChooserDesktopLocation = new Point(this.ParentForm.DesktopLocation.X, this.ParentForm.DesktopLocation.Y);
columnChooserDesktopLocation.Offset(50, 50);
radGridView.ColumnChooser.DesktopLocation = columnChooserDesktopLocation;
}
But I am bit apprehensive of ParentForm being NULL or this approach not working correctly for some reason. Thus needed to know if there exists a better way of specifying the location of the ColumnChooser.
Also, more importantly, I want the above code to work even if the user has more than one monitor/display unit.
Thanks,
~Abhay