RadGridView jumps to top on lose focus

5 posts, 0 answers
  1. Tim
    Tim avatar
    11 posts
    Member since:
    May 2013

    Posted 14 Nov 2016 Link to this post

    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?

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 16 Nov 2016 Link to this post

    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!
  3. Tim
    Tim avatar
    11 posts
    Member since:
    May 2013

    Posted 16 Nov 2016 Link to this post

    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>

     

  4. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 18 Nov 2016 Link to this post

    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.
  5. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 23 Nov 2016 Link to this post

    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.
Back to Top