Click here to Skip to main content
15,921,531 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi!

How can i change the text align of a listbox?

thanks :)
Posted
Comments
BobJanova 13-Jan-12 8:28am    
WPF or WinForms?

I'm not actually sure this is possible with the standard Windows control without making it owner draw (at which point it's obviously trivial).

Try this:

XML
<style type="text/css">
        .lstcss
        {
            direction:rtl;
            width: 200px;
        }
    </style>

    <asp:ListBox ID="ListBox1" runat="server" CssClass="lstcss">
    <asp:ListItem Value="1">One</asp:ListItem>
    <asp:ListItem Value="2">Two</asp:ListItem>
    </asp:ListBox>
 
Share this answer
 
Comments
i.fakhari 13-Jan-12 7:26am    
thanks but i use c#,
if you know give me c# codes
Hi,
Use this,
XML
<style type="text/css">
    .rlbItem
    {
        float: left;
    }
    .rlbGroup, .RadListBox
    {
        width: auto;
    }
</style>
 
Share this answer
 
Comments
i.fakhari 13-Jan-12 7:42am    
Sorry but i use c#!!!

why u all give me web codes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900