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

Edit Triggers On The Cell Level

3 Answers 365 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 15 Nov 2016, 08:03 AM

Hi, 

Is there a way to set edit triggers on the cell level? I need that in the same column, some of the cells will have a different edit trigger value from other cells (depends on a certain bushiness logic condition that can be implemented in a converter, for example).

3 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 17 Nov 2016, 11:04 AM
Hello David,

EditTriggers can be set only on Column or RadGridView level. However, you can mimic  this behaviour by handling the PreviewMouseDown event in this way:
private void clubsGrid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
       {
           var clickedElement = e.OriginalSource as FrameworkElement;
           var cell = clickedElement.ParentOfType<GridViewCell>();
           if (cell != null)
           {
               var club = cell.ParentRow.Item as Club; //this is the data object
               if (club.StadiumCapacity > 5)
               {
                   clubsGrid.CurrentCellInfo = new GridViewCellInfo(club, cell.Column);
                   this.clubsGrid.BeginEdit();
               }
               
           }
       }

In this way you will be able to enter in edit mode with a single click on items which StadiumCapacity is greater than 5 (this is the custom condition).

I hope this will work for you.

Regards,
Yoan
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
David
Top achievements
Rank 1
answered on 20 Nov 2016, 10:18 AM

Thanks. Actually I find this approach inappropriate to my specific needs, but I found another solution -

1) The EditTrigger of the grid is always set to "CellClick".

2) The visibility of the CellEditTemlpate is bounded to a converter, that returns "Visible" in case the cell should be editable and "Hidden" in case not. This gives the user an illusion that the cell is not in edit mode, even though it is.

0
Yoan
Telerik team
answered on 23 Nov 2016, 01:12 PM
Hi David,

I am glad to hear that

I will research the possibility of exposing an EditTriggers property of the GridViewCell. I will update this thread when the research is finished.

Regards,
Yoan
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
Yoan
Telerik team
David
Top achievements
Rank 1
Share this question
or