12 Answers, 1 is accepted
There is a property called EditTriggers both on a grid and on a column level. Indeed the default edit triggers are F2, CurrentCellClick and TextInput. You can easily set this property in xaml like this:
<
telerik:RadGridView
EditTriggers
=
"Default, CellClick"
.../>
in order to meet your goals. Regards,
Nedyalko Nikolov
the Telerik team
May you provide a bit more details about your exact scenario and the settings of the grid? Generally, if a cell is disabled or read-only, it cannot be edited. I am sending you the sample project I used for testing the case. The first column is disabled, while the second one is read-only. However, typing on each of the does not result in editing the cell.
Let me know in case of any misunderstandings.
Maya
the Telerik team
You are quite correct - the behavior can be indeed reproduced following the steps you described. The issue will be resolved with the upcoming Service Pack. So, once the fix is available, you will still be able to navigate as now, but editing the cell will not be allowed.
Thank you for your cooperation.
Maya
the Telerik team
My grid row cells are still editable (so long as they have a control other than a textbox for editing). The cells that would have a textbox for editing (even the column defined as readonly in xaml) are throwing up a NullReferenceException when they attempt to enter edit mode.
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Windows.Controls.GridViewBoundColumnBase.EvaluateIsReadOnlyState(Object item)
at Telerik.Windows.Controls.GridViewBoundColumnBase.CanEdit(Object item)
at Telerik.Windows.Controls.GridView.GridViewDataControl.BeginEdit(GridViewCell gridViewCell, RoutedEventArgs editingEventArgs)
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCellMouseDown(GridViewCell cell, MouseButtonEventArgs args)
at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)
......
I'm not sure what is going on, but I need to be able to set the grid to readonly based on business rules and it seems that it isn't working.
The only cell that is behaving is a column that I defined in xaml as readonly, but is bound to datetime value (so the default editor wouldn't be a textbox).
Can anyone help with this?
Can you post more info about your grid version? Is it our Q2 2011 or Q2 2011 SP1?
Regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I'll try to clarify IsReadOnlyBinding property a little bit.
The idea behind this property is to determinate of a single row can enter into edit mode. Therefore IsReadOnlyBinding property has underlying business object (which is about to enter in edit mode) as DataContext. For example if you are trying to put cell (row 2 and column 2) in edit mode IsReadOnlyBinding.DataContext will be row2.DataContext, no matter that this property is set on a column or on a grid level. Keeping this in mind in order to achieve your goals IsReadOnlyBinding should be bound to a property of your BO.
For more information about IsReadOnlyBinding property you can take a look at this online help topic.
Let me know if there is something unclear.
Nedyalko Nikolov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>