I used the property builder tool and added a checkboxcolumn to my radgridview. I want to have an picturebox in the column that will put a different image based upon some boolean value.
I have everything working, but I cannot get the control to be centered in the column. I am adding the RadImageItem as such:
I'm sure that there is an easy way to do this, but I am not able to locate it. The Alignment Properties do not seem to adjust this.
Thanks as always.
Dennis
I have everything working, but I cannot get the control to be centered in the column. I am adding the RadImageItem as such:
If TypeOf e.CellElement.ColumnInfo Is GridViewDataColumn AndAlso DirectCast(e.CellElement.ColumnInfo, GridViewDataColumn).DataField = "HasComments" Then | |
If Not (TypeOf e.CellElement.RowElement Is GridHeaderRowElement) Then | |
'exclude Header element in the data column | |
If e.CellElement.Children.Count > 0 Then | |
If e.CellElement.Children(0).GetType() Is GetType(Telerik.WinControls.UI.RadCheckBoxEditor) Then | |
' remove the checkbox | |
e.CellElement.Children.RemoveAt(0) | |
Dim pieceid As Integer = CType(e.CellElement.RowElement.RowInfo.Cells("PieceId").Value, Integer) | |
Dim hasComments As Boolean = ' load has comments | |
Dim img As RadImageItem = New RadImageItem() | |
If hasComments Then | |
img.Image = My.Resources.Resources.green | |
Else | |
img.Image = My.Resources.Resources.red | |
End If | |
e.CellElement.Children.Add(img) | |
e.CellElement.Children(0).Alignment = ContentAlignment.MiddleCenter | |
e.CellElement.Alignment = ContentAlignment.MiddleCenter | |
End If | |
End If | |
End If | |
End If |
I'm sure that there is an easy way to do this, but I am not able to locate it. The Alignment Properties do not seem to adjust this.
Thanks as always.
Dennis