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

GridView

1 Answer 51 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lucas
Top achievements
Rank 1
Lucas asked on 05 Apr 2016, 08:51 PM

When a cell has  multi-lined wrapped text, and both vertical and grid extends beyond window size (have both vertical and horizontal scroll):

Scrolling vertical scroll to the bottom, then horizontal to the right causes the vertical scrollbar to jump away from bottom.

XAML

<Window x:Class="GridScrollbarIssue.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
        xmlns:TelerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="MainWindow" Height="350" Width="400">   
    
    <Grid>
        <TelerikGridView:RadGridView ItemsSource="{Binding Collection}" AutoGenerateColumns="False">
            <TelerikGridView:RadGridView.Columns>
                <TelerikGridView:GridViewDataColumn Header="Column 1" DataMemberBinding="{Binding Col1}" Width="125" IsFilterable="True" >
                    
                </TelerikGridView:GridViewDataColumn>                    
            <TelerikGridView:GridViewDataColumn Header="Column 2"  DataMemberBinding="{Binding Col2}" Width="125" IsFilterable="True" >
                    
                </TelerikGridView:GridViewDataColumn>             
            <TelerikGridView:GridViewDataColumn Header="Column 3"  DataMemberBinding="{Binding Col3}" Width="125" IsFilterable="True" >
                    
                </TelerikGridView:GridViewDataColumn>             
            <TelerikGridView:GridViewDataColumn Header="Column 4"  DataMemberBinding="{Binding Col4}" Width="125" IsFilterable="True" >
                    
                </TelerikGridView:GridViewDataColumn>
                <TelerikGridView:GridViewDataColumn Header="Column 5" DataMemberBinding="{Binding Col5}" Width="125" IsFilterable="True" TextWrapping="Wrap">
                    
                </TelerikGridView:GridViewDataColumn>                    
            </TelerikGridView:RadGridView.Columns>
        </TelerikGridView:RadGridView>
    </Grid>
</Window>

 

C#:
using System.Collections.ObjectModel;
using System.Windows;

namespace GridScrollbarIssue
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public ObservableCollection<Model> Collection { get; set; }
        public MainWindow()
        {
            Collection = CreateCollection();

            InitializeComponent();            
        }

        private static ObservableCollection<Model> CreateCollection()
        {
            return new ObservableCollection<Model>
            {
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},               
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                new Model {Col1 = "", Col2 = "col2", Col3 = "col3", Col4 = "col4", Col5 = ""},
                 new Model
                {
                    Col1 = "",
                    Col2 = "col2",
                    Col3 = "col3",
                    Col4 = "col4",
                    Col5 =
                        "test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test "
                },
            };
        }
    }

    public class Model
    {
        public string Col1 { get; set; }
        public string Col2 { get; set; }
        public string Col3 { get; set; }
        public string Col4 { get; set; }
        public string Col5 { get; set; }
    }
}


1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 07 Apr 2016, 07:20 AM
Hi Lucas,

Actually, this would be the expected behavior as that particular cell starts participating on the scroll info calculation when it is realized and about to be displayed. And since its height is more that the default one, there should be a recalculation of the scrolling behavior so that you can scroll to the bottom and see its whole content. 

Regards,
Maya
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Lucas
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or