Listview:Right align the 1st column


Author
Message
Michel Levy
Michel Levy
StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Hi,

I need to right align the 1st column of a listview, where data are Integer.
I understand that these integer are "mapped" to text for displaying in the listview, but why is it impossible to set alignment to right on the first column (and only the first, alignment works fine on other columns)
either in property sheet or in ListPopulating event, it does not work.

As a workaround, I set the format to D5, but the readability is poor. What do I forget? How could I right align, or PADL with spaces?

thanks

Attachments
populset.jpg (117 views, 40.00 KB)
espion.jpg (134 views, 36.00 KB)
devisu.jpg (145 views, 9.00 KB)
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Michael,

Maybe you can have a dummy fist column (Index 0) with 0 width and not header, then have the real column (Index 1) which will hold your integer and can get the alignment to the right with no problem.

I believe there should be some technical explanation as to why the first column can not be aligned to the right.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I believe there should be some technical explanation as to why the first column can not be aligned to the right.

Yes, but it wil have to come from Microsoft! Smile  Our ListView inherits from the standard .NET ListView. This will change in future releases so that we have 100% control over things just like this.  Dustin will post a workaround shortly.

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Edhy hit on the workaround already. Just add a 0 width column and make sure it is the topmost column in your columns collection. See the attachments for an illustration on how to configure the columns and proof that it works Smile.

As Trent said, this is behavior that has been inherited from the standard Microsoft ListView. The first column added to the column's collection cannot be set to right aligned via the property sheet, and the topmost column in the collection (whether it was the first column created or not) will always be left aligned regardless of what the alignment property is set to. I have no idea why they do it that way, but until we have our own listview that doesn't inherit from Microsoft's, we are going to have to work around it w00t.

Attachments
Listview_0WidthColumn.png (144 views, 23.00 KB)
Listview_1stColumnRightAligned.png (142 views, 29.00 KB)
Michel Levy
Michel Levy
StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Eddy,

Of course, you are right, I'll add a dummy column w00t

Thanks a lot...

Trent,

I could not believe it was simply a "bug by design" from MS Doze

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search