This is a migrated thread and some comments may be shown as answers.

GridViewCheckBoxColumn checkBox alignment center

1 Answer 758 Views
GridView
This is a migrated thread and some comments may be shown as answers.
RR
Top achievements
Rank 1
RR asked on 04 Apr 2016, 06:13 AM
My Gridview is with dynamically bound Checkbox columns.Columns represent a meeting. 
GridViewCheckBoxColumn checkBoxColumn = new GridViewCheckBoxColumn();
              var bindingPath = string.Empty;
              Binding bind = new Binding();
              bindingPath = "MeetingsList[" + meeting.MeetingId + "].IsAdded";
              bind = new Binding(bindingPath);     
              bind.Mode = BindingMode.TwoWay;
              bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;                  
              checkBoxColumn.DataMemberBinding = bind;
 
              checkBoxColumn.IsReadOnly = meeting.IsTrackingDisable;
              //meeting.IsTrackingDisable = true;
              
              checkBoxColumn.EditTriggers = GridViewEditTriggers.CellClick;
                  
              checkBoxColumn.AutoSelectOnEdit = true;
 
 
              checkBoxColumn.Header = meeting.Name ;
              checkBoxColumn.UniqueName = meeting.MeetingId;
              //checkBoxColumn.CellStyle = CheckStyle;
              checkBoxColumn.TextAlignment = TextAlignment.Center;
 
              Columns.Add(checkBoxColumn);

 

The Problem is here I get the checkboxes all Left aligned. I want it to be centered. I tried using the CellStyle. it does the trick but thenI have to Use Checked, Unchecked Events. That is not feacible. So is there a way to set CheckBox centered in C# code?

Thank you in advance

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 04 Apr 2016, 09:54 AM
Hi Roshan,

I would suggest you to check the Centering the checkbox section from this help article.

Regards,
Yoan
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
RR
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or