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.
9 Answers, 1 is accepted
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?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
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
>
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?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
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.
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
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 >>
if there is a workaround to allow correct focus on RowDetailsTemplate it'd be much appreciated.
I have another rad grid in a separate project where I'm setting the items source in the code behind and it works fine.
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.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>