Changing Focus for RowDetails

10 posts, 0 answers
  1. Kyle
    Kyle avatar
    7 posts
    Member since:
    Jun 2011

    Posted 01 Feb 2012 Link to this post

    First of all, I'm rather new to using Telerik so I apologize if the answer to this is obvious.

    I'm trying to use a RadGridView to display a list and each item on the list can be further expanded using a RowDetailsTemplate to contain the expanded content.  Inside this expanded content, I have a few buttons.  The problem comes when I try to click the button after expanding the row, I have to click twice to get it to work.

    I'm guessing the problem is that the focus is not currently on that particular row and thus the first click is simply changing the focus while the second activates the button's event.  Is there any way to either make it so that the focus does not need to be on the row details section to click this button (without changing it's location to be outside of the details section) or at least a way to get the focus to change once the row is expanded?

    Thanks in advance.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 02 Feb 2012 Link to this post

    Hi,

    I have tested using a RowDetailsTemlate with two buttons in a StackPanel. After I expanded the RowDetails the logic on the buttons' click was working fine after a single click. 

    Would you please specify how have you defined the RowDetailsTemplate?  

    Greetings,
    Didie
    the Telerik team

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

  3. Kyle
    Kyle avatar
    7 posts
    Member since:
    Jun 2011

    Posted 02 Feb 2012 Link to this post

    Here's the basic idea of what it looks like.  Hopefully all the relevant sections are included as I didn't write this section of code myself, but am just trying to "fix" it.

    <telerik:RadGridView Grid.Row="4" telerik:StyleManager.Theme="{StaticResource CustomTheme}" IsReadOnly="True" x:Name="RadResultsGrid" AutoGenerateColumns="False" Margin="0, 25, 0, 0" EditTriggers="Default" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" SelectionMode="Extended" RowStyleSelector="{StaticResource Current}"
    ItemsSource="{Binding Path=BillAccountTerm.Installments, Mode=TwoWay}" Width="Auto">
    <telerik:RadGridView.Columns>
    <telerik:GridViewToggleRowDetailsColumn />
    ... (Headers and such inserted here)
    </telerik:RadGridView.Columns>
    <telerik:RadGridView.RowDetailsTemplate>
    <DataTemplate>
    <StackPanel Margin="20,10,0,0" >
    ....
    <Button Content="Waive" Width="150" Margin="5, 0, 5, 0" Command="{Binding Source={StaticResource DataContextProxy}, Path=DataSource.WaiveCommand}" CommandParameter="{Binding Id}" HorizontalAlignment="Left" IsEnabled="{Binding Source={StaticResource DataContextProxy}, Path=DataSource.CurrentUser.CanWaive}"/>
    ...
    </StackPanel>
    </DataTemplate>
    </telerik:RadGridView.RowDetailsTemplate>
    </telerik:RadGridView>
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 03 Feb 2012 Link to this post

    Hi,

     I have tested using the code snippet provided. As I am not aware of how you have defined your Command, I have replaced it with a Click event. The click event was raised fine after the first click.
    What is the version that you use? Would you please do a simple test to see if the Click event will be fired on the first click?

    Regards,
    Didie
    the Telerik team

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

  5. Kyle
    Kyle avatar
    7 posts
    Member since:
    Jun 2011

    Posted 03 Feb 2012 Link to this post

    Well I replaced it with a click event and it seems to do the same thing as before.  It requires me to click inside the expanded section one time before clicking the button will activate the event.
    I believe the current version of Silverlight is 4 and the latest Telerik is Q2 2011 version 11.2.712.0.

    Thank you again for you time.


    Update:  I found something a little odd.  It seems that once I've clicked on the details box for a single row then no matter what else I click on within the page and no matter which other row I try to use, when I come back to try and click on a button in the row details it works fine.  It just needs that very first click on the row details section for some odd reason. 
    I've also tried removing everything from the page except for the most basic parts of the RadGridView, the ToggleRowDetailsColumn, and the button itself and the behavior is still the same.  So as far as I can tell, it is indeed something to do with the RadGridView and/or the RowDetails.
  6. Denis
    Denis avatar
    9 posts
    Member since:
    Jul 2010

    Posted 02 May 2012 Link to this post

    I've just started looking into the exact same issue myself
    if I click on an element in the row first, everything in the rowdetails works fine once expanded
    if I simply expand the row and click on an object inside the rowdetails control everything inside the rowdetails 'jolts' slightly and nothing is focused, a second click is required.

    using build 2011.2.712.1040
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 02 May 2012 Link to this post

    Hello,

     Do you get the same problem with the latest assemblies (Q1 ServicePack 2012)? 

    All the best,
    Didie
    the Telerik team

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

  8. Denis
    Denis avatar
    9 posts
    Member since:
    Jul 2010

    Posted 02 May 2012 Link to this post

    We are already in UAT phase, so won't be updating to the latest packages at this point.

    if there is a workaround to allow correct focus on RowDetailsTemplate it'd be much appreciated.
  9. Denis
    Denis avatar
    9 posts
    Member since:
    Jul 2010

    Posted 02 May 2012 Link to this post

    update: it only seems to be occuring when the radgridview  ItemsSource is bound in the xaml.

    I have another rad grid in a separate project where I'm setting the items source in the code behind and it works fine.
  10. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 03 May 2012 Link to this post

    Hi,

     I have created a sample project in my attempt to reproduce the issue. I use the click event of the button as I am not sure how you have defined your command. So far I was not able to. Please review the sample and let me know how can I get the problem.

    That way I can try to suggest a workaround.

    All the best,
    Didie
    the Telerik team

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

Back to Top