In Flex3, I could center a checkbox within a datagrid column using this:
<mx:DataGridColumn textAlign="center" itemRenderer="mx.controls.CheckBox"/>
That is, the centering is specified on the column. In Flex4, that doesn't work. I have to put the centering on the renderer rather than on the column.
<mx:DataGridColumn>
<mx:i开发者_如何学编程temRenderer>
<mx:Component>
<mx:CheckBox textAlign="center"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
Does anyone know if this change from Flex3 to Flex4 was intentional?
You need to put the checkbox inside a canvas:
<mx:Component>
<mx:Canvas width="100%" height="100%">
<mx:CheckBox textAlign="center"/>
</mx:Canvas>
</mx:Component>
精彩评论