I have a problem when trying to format my Gridview text. On my cell I set text alignment using the following:
myCell.TextAlignment = TextAlignment.Right; |
Is there anything I can try to fix this? It's probably going to be a deal-breaker for this project in terms of using Telerik's gridview control.
11 Answers, 1 is accepted
Please set EnableColumnVirtualization to false and let me know about the result.
Greetings,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
-Dean
You can use template instead and if you want condition alignment you can use IValueConverter - I've attached an example project for reference.
Greetings,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Condition formatting with IValueConverter is the correct way - otherwise the grid virtualization will reset your setting once the cell is recycled.
Kind regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Indeed the column property TextAlignment will work as expeceted however if you assign cell.TextAlignment you may get such problems.
Greetings,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
<DockPanel> <DockPanel.Resources> </DockPanel.Resources> <worklist:workListGridHeaderPanel DockPanel.Dock="Top" /> <tgrid:RadGridView x:Name="dataGrid1" IsReadOnly="True" IsFilteringAllowed="False" ShowGroupPanel="False" ItemsSource="{Binding}" AutoGenerateColumns="False" SelectionMode="Single" RowIndicatorVisibility="Collapsed" ScrollMode="RealTime" DataLoadMode="Asynchronous" EnableRowVirtualization="True" EnableColumnVirtualization="True" ShowColumnFooters="True" GridLinesVisibility="Horizontal" > <tgrid:RadGridView.Columns> <tgrid:GridViewDataColumn Header="CaseSeq" UniqueName="CaseSeq" IsVisible="False" DataMemberBinding="{Binding CaseSeq}" /> <tgrid:GridViewDataColumn Header="Days Remaining" UniqueName="DaysRemaining" DataMemberBinding="{Binding ProbationDaysRemaining}" TextAlignment="Right" /> <tgrid:GridViewDataColumn Header="Balance" UniqueName="Balance" DataMemberBinding="{Binding Balance}" DataFormatString="{}{0:C}" TextAlignment="Right"/> <tgrid:GridViewDataColumn Header="CS Balance" UniqueName="CSBalance" DataMemberBinding="{Binding CSBalance}" TextAlignment="Right" /> </tgrid:RadGridView.Columns> </tgrid:RadGridView> </DockPanel> |
This appears fine when the grid is initially displayed but all the right-aligned fields are aligned inconsistently when scrolled (sometime left sometimes right). Are you saying this is the correct behavior?
I've just tried this using our latest Q1 2010 Beta (will be released in a week officially) however everything worked as expected - you can check the attached application for reference.
All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks.