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

[Solved] Combination of CTRL Key and MOUSE LEFT CLICK , inside RowDetailsTemplate collapses the visibility of the GridView.

5 Answers 85 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jitendra wadhwani
Top achievements
Rank 1
jitendra wadhwani asked on 29 Dec 2009, 05:56 AM
I have following combination on my xaml:

1 - GridView with RowDetailsTemplate
2 - RowDetailsTemplate contains another usercontrol (xaml).
3 - This user control contains various controls like ListBoxes.
4 - If user presses (CTRL key + Mouse Left Click ) i.e. to select Multiple items in listbox, RowDetailsVisibilityChanged event is fired and RowDetailsVisibility collapses.
5 - PLEASE NOTE : EVEN IF THE USER PRESSES (ctrl key + mouse left click)  AND CLICK anywhere on RowDetailsTemplate, the visibility still collapses.

TRIED FOLLOWING :

1 - inside RowDetailsVisibilityChanged event, set RowDetailsVisibility explicityly to "IsVisibileWhenSelected", but it still shows up the grid in Collapsed Mode, only.

5 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 29 Dec 2009, 12:00 PM
Hello jitendra wadhwani,

This happens because CTRL - Left Click deselects the row and thus hides the row details. You have two options:

1. Use a GridViewToggleRowDetailsColumn instead of relying on VisibleWhenSelected Mode.
2. Change the SelectionMode of the grid to be Extended.

I hope this helps. Let me know if you have any other questions.

Best wishes,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
jitendra wadhwani
Top achievements
Rank 1
answered on 30 Dec 2009, 06:31 AM
HI,
Please note I am using RadGridView in Silverlight.

I am not able to find either of the SelectionMode or GridViewToggleRowDetailsColumn property upon the grid control.
0
jitendra wadhwani
Top achievements
Rank 1
answered on 30 Dec 2009, 06:34 AM

Please Note,
the namespace is Telerik.Windows.Controls.RadGridView

 

Thanks !

Jitendra

0
jitendra wadhwani
Top achievements
Rank 1
answered on 30 Dec 2009, 06:51 AM
Also Please Note,
using GridViewToggleRowDetailsColumn might not help me since:

Requirement is as follows:
1. rowdetails SHOULD NOT expand if the user clicks on the row anywhere, BUT SHOULD ONLY EXPAND, if the user clicks on "EDIT" (last) column link (imagebutton).

- all other possibilities of rowdetails being visibie and collapsed are already handled.
- only the case for combination of "left click + ctrl key" is not captured.

Something like "SelectionMode="Extended"" will be of great help.
But i didnt see this "SelectionMode="Extended" "  upon my grid.
0
Rossen Hristov
Telerik team
answered on 30 Dec 2009, 09:25 AM
Hi jitendra wadhwani,

1. You will need to get the latest version from your Client.Net and upgrade to it. This will give you the new GridViewToggleRowDetailsColumn which does exactly what you need -- toggles row details. You can see it in action in this online example.

If you choose to develop your own custom column with your own custom button that will toggle row details please read on.

2. Set the RowDetailsVisibilityMode of the grid to "Collapsed" since you will handle expand / collapse manually from the edit button on your custom column. Setting the mode to "Collapsed" will prevent row details from expanding and collapsing when the user click on the row. (which is the VisibleWhenSelected mode)

3. To see how to hook up your custom column button to the DetailsVisibility property of the GridViewRow, please read my blog post How To: Display Hierarchical Data with Row Details (RadGridView for Silverlight)

In the blog post I have created a column like yours -- with a button. Here is how I create my special column:

public class DetailsToggleColumn : GridViewColumn
 2: {
 3: public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
 4: {
 5: var parentRow = cell.ParentRow as GridViewRow;
 6: if (parentRow != null)
 7: {
 8: return new DetailsToggleButton(parentRow);
 9: }
 10:  
 11: return null;
 12: }
 13:  
 14: ...
 15: }

And here is how I hook my special toggle button to the row details visibility of the parent row (this will be your edit button in your case):

public partial class DetailsToggleButton : UserControl
 2: {
 3: private readonly GridViewRow parentRow;
 4: 
 5: public DetailsToggleButton(GridViewRow parentRow)
 6: {
 7: this.InitializeComponent();
 8: 
 9: this.parentRow = parentRow;
 10: 
 11: this.Init();
 12: }
 13:  
 14: private void Init()
 15: {
 16: var b1 = new Binding("IsChecked")
 17: {
 18: Source = this.toggleButton,
 19: Mode = BindingMode.TwoWay,
 20: Converter = new BooleanToVisibilityConverter()
 21: };
 22:  
 23: this.parentRow.SetBinding(GridViewRow.DetailsVisibilityProperty, b1);
 24: }
 25: }

Download and examine the source code from my blog post to get started. It tackles the case you are after.

Reading the documentation about Row Details will also help you a lot.

I hope this helps.

All the best,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
jitendra wadhwani
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
jitendra wadhwani
Top achievements
Rank 1
Share this question
or