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

Column (re)sizing issues

4 Answers 129 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nikos
Top achievements
Rank 1
Nikos asked on 01 Mar 2012, 09:52 AM
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":

  1. 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.
  2. 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)
  3. 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: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.Controls
Imports Telerik.Windows.Controls.GridView
Imports Telerik.Windows.Data
 
Class 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 Function
 
End Class

DataModelObject.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 Decimal
 
End Class

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

4 Answers, 1 is accepted

Sort by
0
Vera
Telerik team
answered on 01 Mar 2012, 03:39 PM
Hi Nikos,

 
Actually, the reported issues are known and they are logged into our Public Issue Tracking System. We will do our best to address them as soon as possible.

Excuse us for the inconvenience caused.


Regards,
Vera
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Joan
Top achievements
Rank 1
answered on 26 Mar 2012, 10:24 AM
Hi,,

I am experiencing the Maximize-Restore behaviour too, using RadControls for WPF 2012.1.0215 Dev.

Is there a way to force the RadGridView to recalculate all columns width?
0
Dave
Top achievements
Rank 2
answered on 05 Jun 2012, 02:51 PM
Greetings,

Also running into the above issues. Number 3, especially, is driving everyone nuts.

  • Like Joan, I was hoping for a way to force a recalculation of the column widths. Any progress along this line of thought?
  • Also, wasn't able to find the Issue on the Public Tracking System. Any chance you can point me in the correct direction, perhaps a link?

Thanks for any help,

- dh
0
Vera
Telerik team
answered on 07 Jun 2012, 04:17 PM
Hi,

 
The second issue has been resolved and the fix for it is available with our Q1 SP1 2012. I was not able to reproduce the third issue either. Please download the service pack and give it a try.


Kind regards,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Nikos
Top achievements
Rank 1
Answers by
Vera
Telerik team
Joan
Top achievements
Rank 1
Dave
Top achievements
Rank 2
Share this question
or