![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | How to right align text in a listview ? Hi all, Simple question : I try to right align textbox which display numbers in a listview column. But it's as if WPF just ignore my statement. Looking closer i realised that the textbox is well right align but it disgards my Width = Stretch setting and make the textbox always sized to auto, just as if there were no parent to size it (and indeed, there is no). I guess that's because the "container" column is not a control. How to prevent that as there is no horizontal alignment property on the column itself. Thanx in advance. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How to right align text in a listview ? Nobody, really ?!! |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How to right align text in a listview ? You can define a Style to the ListViewItem, like this: <Style x:Key="ListItemStyle" TargetType="{x:Type ListViewItem}"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> </Style> Then apply the style: <ListView ItemContainerStyle="{StaticResource ListItemStyle}"> <ListView.View> <GridView> <GridViewColumn Header="Right Aligned Numbers" Width="200"/> </GridView> </ListView.View> <TextBox TextAlignment="Right">1</TextBox> <TextBox TextAlignment="Right">2</TextBox> </ListView> This will give you stretched text box to fill the column with right alignment. HTH, Plamen Ratchev http://www.SQLStudio.com |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Display does not align text properly | Vista General | |||
| How to Align Desktop items in VISTA??? | Vista General | |||