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

RadGridView jumps to top on lose focus

4 Answers 407 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 14 Nov 2016, 01:30 PM

When RadGridView loses focus, it jumps to the top of it's items. This is really bad behaviour when inserting a row. If I'm halfway through entering details for a new row and I happen to click on anything else outside the grid, the grid jumps to the top and the row I'm inserting disappears out of view...

I want the grid to stay exactly where it is, unless the user manually scrolls it themselves.

Is there any way to prevent the grid from automatically scrolling or moving during/after inserting and/or editing?

4 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 16 Nov 2016, 09:36 AM
Hi Tim,

The behavior you have described indeed sounds unpleasant, however, it cannot be reproduced in a sample scenario at my end. It seems like it is caused due to some specification of your setup. Would it be possible to share more details regarding your case? Actually, raising a ticket with a sample application would be the best approach as we should be able to identify the source of the issue and advise you appropriately. In the meantime, I suggest you check the Tips and Tricks article and make sure you follow the guidelines provided there. 

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Tim
Top achievements
Rank 1
answered on 16 Nov 2016, 11:32 AM

Hi Stefan,

Thanks for your reply. Please see the XAML below which demonstrates the issue in question. This is a very basic version similar to the set up I am trying to use, which has a ListBox as a CellTemplate. I believe that this is what is causing the 'jump to top' behaviour as if I remove the ListBox templated column the grid functions correctly when adding a new row.

In order to see the issue, click 'Add New Row' then immediately hit Enter. Do this a few times until the next new item causes the grid to have to scroll. At this point every time you add a new row and hit Enter, the grid will jump to the top.

 

<StackPanel Width="500" Height="200">
<telerik:RadGridView NewRowPosition="Bottom" GroupRenderMode="Flat" Width="500" Height="200">
<telerik:RadGridView.Columns>

<telerik:GridViewColumn Header="Test_TextBox" Width="*">
<telerik:GridViewColumn.CellTemplate >
<DataTemplate>
<TextBox Width="100" Text="" />
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
</telerik:GridViewColumn>

<telerik:GridViewDataColumn Header="Item_List" Width="3*">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>

<ListBox>
<ListBox.Items>
<ListBoxItem>123</ListBoxItem>
<ListBoxItem>456</ListBoxItem>
<ListBoxItem>789</ListBoxItem>
<ListBoxItem>000</ListBoxItem>
</ListBox.Items>
</ListBox>

</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>

</telerik:RadGridView.Columns>
</telerik:RadGridView>
</StackPanel>

 

0
Stefan Nenchev
Telerik team
answered on 18 Nov 2016, 11:25 AM
Hi Tim,

Thanks for the clarification. I managed to reproduce the issue. I will need some time to examine it and, hopefully, suggest a possible workaround. I will update the thread once I have more information.
 
Regards,
Stefan Nenchev
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Stefan Nenchev
Telerik team
answered on 23 Nov 2016, 12:01 PM
Hello Tim,

I have managed to avoid the undesired behavior by setting a fixed RowHeight for the RadGridView that is bigger or equal to the height of the custom element(the ListBox). Please check the attached sample and try such approach at your end as well. I will be looking forward to your update whether such modification has made a difference in your actual application.

Regards,
Stefan Nenchev
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
GridView
Asked by
Tim
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Tim
Top achievements
Rank 1
Share this question
or