简体   繁体   English

DataGrid列的中心是否从Flex3更改为Flex4?

[英]Did centering within a DataGrid column change from Flex3 to Flex4?

In Flex3, I could center a checkbox within a datagrid column using this: 在Flex3中,我可以使用以下方法将复选框置于datagrid列的中央:

<mx:DataGridColumn textAlign="center" itemRenderer="mx.controls.CheckBox"/>

That is, the centering is specified on the column. 即,在列上指定居中。 In Flex4, that doesn't work. 在Flex4中,这不起作用。 I have to put the centering on the renderer rather than on the column. 我必须将中心放在渲染器上而不是在列上。

<mx:DataGridColumn>
   <mx:itemRenderer>
      <mx:Component>
         <mx:CheckBox textAlign="center"/>
      </mx:Component>
   </mx:itemRenderer>
</mx:DataGridColumn>

Does anyone know if this change from Flex3 to Flex4 was intentional? 有人知道这种从Flex3到Flex4的更改是否是故意的吗?

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM