This is a migrated thread and some comments may be shown as answers.
Width="*" for a GridViewDataColumn with Grouping causes freeze
6 Answers 44 Views
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Louis asked on 12 Mar 2014, 11:02 PM
I've run into an issue where GridView will freeze when trying to auto-adjust column widths to the available window if a group is applied. I have a series of columns, most of which are Width="Auto", but one of which is Width="*". If I resize the window to allow the * column to expand, then try to reduce the width while a grouping is applied, the horizontal scroll bar flashes and the application freezes. Sometimes it comes back, sometimes it doesn't. Sometimes switching to another window and back seems to help, sometimes it doesn't.

Pausing the debugger while this is occurring (which is only possible some of the time; sometimes Visual Studio is frozen as well) tries to open the file:

c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\ScrollViewer\GridViewScrollViewer.cs

The call stack is:
[External Code]
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewScrollViewer.MeasureOverride(System.Windows.Size availableSize) Line 202 + 0x25 bytes    C#
[External Code]

The problem does not occur if the * column is switched to Auto, or if the Grouping is not applied. It also doesn't seem to happen if no vertical scrolling is necessary.

I am using 2013_3_1209, but have verified the problem still occurs with 2014_1_0224. Below is a simple application which exhibits the problem when you try to reduce the width of the window.

Is there any known way to work around this issue using other settings while achieving the same effect?

<Window x:Class="Scroll.MainWindow"
        Title="MainWindow" Height="350" Width="500">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <telerik:RadGridView ItemsSource="{Binding Path=Items}" AutoGenerateColumns="False" AutoExpandGroups="True"
                                 VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <telerik:RadGridView.GroupDescriptors>
                <telerik:GroupDescriptor Member="Group" />
            </telerik:RadGridView.GroupDescriptors>
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Path=Name}" Width="Auto" />
                <telerik:GridViewDataColumn Header="Number" DataMemberBinding="{Binding Path=Number}" Width="*" />
                <telerik:GridViewDataColumn Header="Group" DataMemberBinding="{Binding Path=Group}" Width="Auto" />
                <telerik:GridViewDataColumn Header="Text" DataMemberBinding="{Binding Path=Text}" Width="Auto" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>

using System.Collections.ObjectModel;
using System.Windows;
 
namespace Scroll
{
    public class Item
    {
        public string Name { get; set; }
        public int Number { get; set; }
        public string Group { get; set; }
        public string Text { get; set; }
    }
 
    public partial class MainWindow : Window
    {
        public ObservableCollection<Item> Items { get; set; }
 
        public MainWindow()
        {
            InitializeComponent();
            Items = new ObservableCollection<Item>();
            for (int i = 0; i < 25; i++)
                Items.Add(new Item()
                {
                    Name = "Object " + i,
                    Number = i,
                    Group = (i % 2 == 1 ? "Odd" : "Even"),
                    Text = "this is just some long text to make the window have to resize some things."
                });
            DataContext = this;
        }
    }
}

6 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 13 Mar 2014, 12:56 PM
Hello,

Would you please try setting RadGridView.GroupRenderMode mode to "Flat'? 
You can find more information on the deference between both the modes in our online documentation:
Grouping Render Modes.


Regards,
Didie
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Louis
Top achievements
Rank 1
answered on 13 Mar 2014, 03:51 PM
Thank you very much Didie, that indeed fixed the freezing problem. It is now leaving a disabled horizontal scroll bar sometimes (screenshot attached), but that is much preferred to freezing! I couldn't easily get the test app to exhibit the same behavior, but the real app uses CellTemplates containing Grids with some Auto and some * Width specifications.
0
Dimitrina
Telerik team
answered on 13 Mar 2014, 04:42 PM
Hello,

We fixed a similar issue with our latest version (2014.1.0224). Would you please test with it?

Regards,
Didie
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Louis
Top achievements
Rank 1
answered on 13 Mar 2014, 05:07 PM
The problem does indeed seem to be resolved in 2014.1.0224. That also explains why I couldn't reproduce it in the test app, which is using that version.

Thank you again Didie!
Louis
0
Kim
Top achievements
Rank 1
answered on 11 Jun 2014, 05:48 AM
i think wifth='*' not need HorizontalScroll.
so it's option changed that ScrollViewer.HorizontalScrollBarVisibility="Hidden".
0
Louis
Top achievements
Rank 1
answered on 11 Jun 2014, 07:02 PM
width="*" just means that column will resize as the grid is resized. That doesn't stop the user from resizing the window to be too small for the grid to fit (including the non-scaling columns). If this occurs, the scroll bars are needed.
Asked by
Louis
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Louis
Top achievements
Rank 1
Kim
Top achievements
Rank 1
Share this question
or