GridViewCheckBoxColumn checkBox alignment center

2 posts, 0 answers
  1. Roshan
    Roshan avatar
    20 posts
    Member since:
    Apr 2012

    Posted 04 Apr 2016 Link to this post

    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;


    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

  2. Yoan
    Yoan avatar
    1128 posts

    Posted 04 Apr 2016 Link to this post

    Hi Roshan,

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

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top