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

Mark a row while selecting and editing multiple cells

3 Answers 45 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dominik
Top achievements
Rank 1
Dominik asked on 19 May 2011, 04:36 PM
HI

We use Silverlight 4 and the RadGridview. Our Grid has lots of columns and when scrolling it is helpfull if the concerned row is mared/selected. Selection works normally fine but when various cells are in edit mode, this no longer works.

The selection settings of our grid are as follows:

IsReadOnly = false;
SelectionMode = SelectionMode.Extended;
SelectionUnit = GridViewSelectionUnit.Cell;
// important to set "AllSelectedCells" to ensure Excel-Like behaviour
ClipboardPasteMode = (GridViewClipboardPasteMode.AllSelectedCells |                                         GridViewClipboardPasteMode.Default);


I tried to find a solution for this and this is the best i have come up with:

datagrid.AddHandler(GridViewCellBase.CellDoubleClickEvent, new EventHandler<RadRoutedEventArgs>(OnCellDoubleClick), true);
 
 
private void OnCellDoubleClick(object sender, RadRoutedEventArgs args)
       {
           if (this.GridMode == EGridMode.EditCells)
           {
               var cell = args.OriginalSource as GridViewCellBase;
               if (cell != null && cell.ParentRow != null)
               {
                   var row = cell.ParentRow;
                   dataGrid.CurrentItem = row.Item;
               }
           }
       }

However, this solution does not work properly because as soon as the user selects some fields, the CurrentItem is changed.

The best solution would be, to have the user click on the rowHeader (RowIndicater-> the first column that shows no data) and thus marks the row (via >> sign that appears for the currentItem).  Is this possible?

Greetings and thanks in advance

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 20 May 2011, 08:17 AM

Hello Dominik,

Could you please reiterate what the actual problems? What do you mean by "when various cells are in edit mode, this no longer works". 



All the best,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dominik
Top achievements
Rank 1
answered on 20 May 2011, 02:38 PM

Hi

Sorry if i didnt get accross what i really wanted. With the help of some screenshots, I try to be a bit more specific.

In the first screenshot (selectedrow.png) you can see that the entire row is selectd and the RowHeader/Indicator also marks this row using the ">" sign (I believe thats because the row displays the CurrentItem).

In the second screenshot (variouscellsselected.jpg) several Cells are selected and there is no ">" sign on the rowheader.

What we need is the possibility to select and edit various cells but still be able to select a row so that the rowheader has the ">" sign. This is needed because some of our grid have many columns (up to 90) and when scrolling horizontally, this would be extremly helpfull.
The row selection should not influence the cell selection.

 ( I know that there are other means such as fix some of the columns, put a row in edit mode so the rowheader displays this, but the customer wants exactly that. We have already discussed this several times.)

Is this possible? I am not sure?

Greetings and thanks in advance.

0
Milan
Telerik team
answered on 25 May 2011, 11:47 AM
Hi Dominik,

Thank you for the details. 

You could try to sync the current item (the item with ">") to the currently active cell. For example:

public MainPage()
{
    InitializeComponent();
  
    this.clubsGrid.CurrentCellChanged += 
        new EventHandler<GridViewCurrentCellChangedEventArgs>(clubsGrid_CurrentCellChanged);
}
  
void clubsGrid_CurrentCellChanged(object sender, GridViewCurrentCellChangedEventArgs e)
{
    this.clubsGrid.CurrentItem = e.NewCell.DataContext;
}

Let me know if that helps.


All the best,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Dominik
Top achievements
Rank 1
Answers by
Milan
Telerik team
Dominik
Top achievements
Rank 1
Share this question
or