I'm CERTAIN there has to be a more elegant way, but this should work -  
put the label inside a VBox with spacers set to 50% height above and  
below...

             <mx:DataGridColumn headerText="Name">
               <mx:itemRenderer>
                 <mx:Component>
                     <mx:VBox>
                         <mx:Spacer height="50%">
                         <mx:Label text="{data.fullName}"/>
                         <mx:Spacer height="50%">
                     </mx:VBox>
                 </mx:Component>
               </mx:itemRenderer>
             </mx:DataGridColumn>

Rick
-----Original Message-----
From: Pan Troglodytes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 06, 2006 6:15 PM
To: flexcoders
Subject: [flexcoders] vertically centering text


Is there any way to vertically center text?  Specifically, I have a  
datagrid column that I want to have the text centered vertically in.

             <mx:DataGridColumn headerText="Name">
               <mx:itemRenderer>
                 <mx:Component>
                   <mx:Label text="{data.fullName}"/>
                 </mx:Component>
               </mx:itemRenderer>
             </mx:DataGridColumn>

Since there is also a image field, the height of each row is a lot  
higher than the text and I don't like how it looks.

I can't find any property that seems to apply.  I know there is a  
"verticalCenter" property, but it takes an int and seems to be  
completely undocumented in the Flex help.  I've also tried working  
with styles but I couldn't find anything that would apply.

-- 
Jason

Reply via email to