This is a migrated thread and some comments may be shown as answers.

RadListBoxItem text alignment problem

3 Answers 158 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
shovavnik
Top achievements
Rank 1
shovavnik asked on 18 Oct 2007, 11:06 AM
Hello,

I'm adding items at run-time to a RadListBox. Some of the items need to be aligned to the left and others to the right.

For the items that need to be aligned to the right, I've tried the following methods:

item.TextAlignment = ContentAlignment.TopRight;

item.StringAlignment = StringAlignment.Far;

TextPrimitive primitive = (TextPrimitive)item.Children[2].Children[1].Children[0];
primitive.PaintTextFormat.LineAlignment = StringAlignment.Far;
primitive.Alignment = ContentAlignment.TopRight;
primitive.StringAlignment = StringAlignment.Far;
primitive.TextFormatFlags = TextFormatFlags.Right;

And some other variations. But none of them work. At best, I get the text pushed a bit to the right: the longer the text string the further right it's pushed. That is, I get the following:

 abc
   asdfghjk
       fdfhjsgkljshgadkjhsalkdhas

Any way to get the alignment to work right?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Angel
Telerik team
answered on 19 Oct 2007, 04:07 PM
Hello shovavnik,

You need to align the layout panel inside items instead of their primitives. This is not very intuitive and we plan to clean that logic soon.

Until we fix this, the current listbox items can be aligned with this code:

C#:
item.Children[2].Alignment = ContentAlignment.MiddleRight;

VB:
item.Children(2).Alignment = ContentAlignment.MiddleRight

Hope this was helpful.
 

Sincerely yours,
Angel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
shovavnik
Top achievements
Rank 1
answered on 19 Oct 2007, 05:48 PM
Thanks Angel,

That successfully aligns the items to the right.

I'm very glad to hear you're planning on improving the intuitiveness of the controls. I'm currently trying them out, and they look really great, except for little things like this that can significantly reduce the usability of the controls and the time-savings relative to competitors.

But it still doesn't solve the problem with the padding. It seems that the longer the string, the more padding is inserted to the RIGHT of the right-aligned text.

Any way to prevent the padding from being inserted this way?

Thanks for your help!

Noam

0
Peter
Telerik team
answered on 22 Oct 2007, 02:22 PM
Hello shovavnik,

We could not reproduce the issue you described. Could you send us a simple project we can use to arrive at the specific behavior?

In order to attach a file, open a support ticket.

Thank you for writing. If you have any additional questions, please don't hesitate to contact us.

All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
shovavnik
Top achievements
Rank 1
Answers by
Angel
Telerik team
shovavnik
Top achievements
Rank 1
Peter
Telerik team
Share this question
or