Version: Q1 2012, .NET40
We have encountered some issues regarding column (re)sizing in the RadGridView. Our scenario is as follows:
We have a minimal definition of the grid in XAML code, while the main constructing part is handled by procedural code. The following three issues occur when the grid columns have mixed GridViewLength unit types of "Star" and "Auto":
We have managed to reproduce issues #1 & #2 in a test project, consisting of the following code:
MainWindow.xaml:
MainWindow.xaml.vb
DataModelObject.vb
Unfortunately, we have not managed to reproduce issue #3. We have strong reason to believe that it is related somehow to the other two issues though, since we found out that setting all column size types to GridViewLengthUnitType.Star resolves the problem. However, that is not a valid workaround for us, since automatic column sizing is an essential requirement in many of our usage scenarios. I have attached the following two screenshots that may give you a better (visual) understanding of this issue.
Yours faithfully,
Nikos Nakas
Entersoft SA Development Department
We have encountered some issues regarding column (re)sizing in the RadGridView. Our scenario is as follows:
We have a minimal definition of the grid in XAML code, while the main constructing part is handled by procedural code. The following three issues occur when the grid columns have mixed GridViewLength unit types of "Star" and "Auto":
- A bizarre behavior takes place when resizing a column with the mouse. The behavior is reproduced by following the two steps bellow:
a. Initially enlarge a column up to some point
b. Then try to shorten the column. After a certain point, the column will be reduced automatically to a minimum width, having been overtaken by its preceding one. - Columns do not size correctly when a sequence of maximize - restore is performed. Instead, after restoring the maximized container, all columns (and thus the GridView as a whole) maintain the size they had obtained at maximization. (which naturally results to the appearance of a vertical scrollbar)
- The grid seems unable to display column sizes correctly, when it is rendered within a non-visible panel (for instance, within a non selected TabItem of a TabControl). To be more specific, all columns seem to be rendered with a minimum width, thus leading to an unacceptable visual effect. That effect gets rectified either by resizing columns through user interaction (which however will lead to issue #1), or after the grid has been visually refreshed (usually by refreshing both its column definition and data source by procedural code)
We have managed to reproduce issues #1 & #2 in a test project, consisting of the following code:
MainWindow.xaml:
<Window x:Class="MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView" Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded"> <Grid> <!--<TabControl> <TabItem Header="Blank Tab"></TabItem> <TabItem Header="RadGridView Tab"> </TabItem> </TabControl>--> <telerik:RadGridView Name="grid" telerik:StyleManager.Theme="Windows7" ShowGroupPanel="False" CanUserResizeColumns="True" CanUserFreezeColumns="False" IsReadOnly="True" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserInsertRows="False" IsFilteringAllowed="False" RowIndicatorVisibility="Collapsed" CanUserReorderColumns="True" ReorderColumnsMode="ReorderColumns"> <telerik:RadGridView.HeaderRowStyle> <Style> <Setter Property="telerikGrid:GridViewHeaderCell.FontWeight" Value="Bold"/> </Style> </telerik:RadGridView.HeaderRowStyle> </telerik:RadGridView> </Grid></Window>MainWindow.xaml.vb
Imports Telerik.Windows.ControlsImports Telerik.Windows.Controls.GridViewImports Telerik.Windows.DataClass MainWindow Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Me.grid.Columns.AddRange(GridColumns) Me.grid.ItemsSource = TestData() End Sub Private Shared Function GridColumns() As IEnumerable(Of GridViewBoundColumnBase) Return { New GridViewDataColumn With {.UniqueName = "String1", .Header = "Topic", .Width = New GridViewLength(1, GridViewLengthUnitType.Star)}, New GridViewDataColumn With {.UniqueName = "String2", .Header = "Company", .Width = New GridViewLength(1, GridViewLengthUnitType.Star)}, New GridViewDataColumn With {.UniqueName = "String3", .Header = "Phase", .Width = New GridViewLength(1, GridViewLengthUnitType.Auto)}, New GridViewDataColumn With {.UniqueName = "Decimal1", .Header = "Revenue", .Width = New GridViewLength(1, GridViewLengthUnitType.Auto)}, New GridViewDataColumn With {.UniqueName = "Decimal2", .Header = "Sales Cycle", .Width = New GridViewLength(1, GridViewLengthUnitType.Auto)} } End Function Private Shared Function TestData() As IEnumerable(Of DataModelObject) Return { New DataModelObject With {.String1 = "100 CRM licenses", .String2 = "SENSO PER LAY", .String3 = "SALE SUCCESSFULL", .Decimal1 = 8000, .Decimal2 = 0}, New DataModelObject With {.String1 = "e-com...", .String2 = "CONTROL SYSTEMS", .String3 = "SALE SUCCESSFULL", .Decimal1 = 22800, .Decimal2 = 0}, New DataModelObject With {.String1 = "LEAD-00004", .String2 = "KLEEMAN HELLAS", .String3 = "SALE SUCCESSFULL", .Decimal1 = 80, .Decimal2 = 122}, New DataModelObject With {.String1 = "Telemarketing services", .String2 = "CITYBANK", .String3 = "SALE SUCCESSFULL", .Decimal1 = 4200, .Decimal2 = 1435} } End FunctionEnd ClassDataModelObject.vb
Public Class DataModelObject Public Property String1 As String Public Property String2 As String Public Property String3 As String Public Property Decimal1 As Decimal Public Property Decimal2 As DecimalEnd ClassUnfortunately, we have not managed to reproduce issue #3. We have strong reason to believe that it is related somehow to the other two issues though, since we found out that setting all column size types to GridViewLengthUnitType.Star resolves the problem. However, that is not a valid workaround for us, since automatic column sizing is an essential requirement in many of our usage scenarios. I have attached the following two screenshots that may give you a better (visual) understanding of this issue.
Yours faithfully,
Nikos Nakas
Entersoft SA Development Department