Intuitive I would take the CellEditEnded event, but maybe there is a smarter way?
Thank you in advance Uwe
7 Answers, 1 is accepted
You could use a CellStyleSelector for that column and return a ReadOnly Style if the conditions based on the other two columns are met.
Kind regards,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

technique, which I will use, but it does not solve my current problem. My GridView is bind
to an QueryableEntityCollectionView and I have 3 columns: ShippingWeight, GrossWeightTruck
and NetWeightTruck. ShippingWeight is read only. The user should edit GrossWeightTruck and
NetWeightTruck and ShippingWeight should be calculated. I am using MVVM Light to fetch the
CellEditEnded Event:
<
telerik:RadGridView
Name
=
"xGridView"
Margin
=
"29,89,38,105"
Grid.ColumnSpan
=
"2"
ItemsSource
=
"{Binding BAMeasurements}"
IsEnabled
=
"{Binding IsChecked, ElementName=UnLock, Mode=TwoWay}"
ScrollMode
=
"RealTime"
DataLoadMode
=
"Asynchronous"
AutoGenerateColumns
=
"False"
>
<
i:Interaction.Triggers
>
<
i:EventTrigger
EventName
=
"CellEditEnded"
>
<
commands:EventToCommand
Command
=
"{Binding CellEditEnded}"
PassEventArgsToCommand
=
"True"
/>
</
i:EventTrigger
>
</
i:Interaction.Triggers
>
...
My problem is to find out which cell is send the event and how do I get the ShippingWeight cell of
the right row?
Greetings Uwe
You could follow this help article where you will find another way to select the appropriate Style. When the SelectStyle method is invoked you have the item (which is the one from the right row) and you could check the property you are interested in.
Please try this and let me know if you have any further questions.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

I found out this:
private
void
CellEditEndedToCommandF(
object
obj)
{
GridViewCellEditEndedEventArgs GridEventArg = (GridViewCellEditEndedEventArgs)obj;
GridViewColumn Colum = GridEventArg.Cell.Column;
string
ColumUniqueName = Colum.UniqueName;
switch
(ColumUniqueName)
{
case
"ShippingWeight"
:
...
break
;
case
"GrossWeightTruck"
:
...
break
;
case
"NetWeightTruck"
:
...
break
;
}
}
... but I'm still looking for the index of the row or something that.
Best Regards

I understand your approach, but when I do this:
/// <summary>
/// CLASS ShippingWeightStyle
/// </summary>
public
class
ShippingWeightStyle : StyleSelector
{
public
override
Style SelectStyle(
object
item, DependencyObject container)
{
if
(item
is
BAMeasurement)
{
BAMeasurement bam = item
as
BAMeasurement;
bam.ShippingWeight = bam.GrossWeightTruck - bam.NetWeightTruck;
Debug.WriteLine(
"RECUSION!!!"
);
}
return
null
;
}
}
I get a recursion....

I am afraid that I pointed you into a wrong direction. I thought that you would like to set some cells to be ReadOnly and others not. Please excuse me for misleading you.
In order to calculate the values in one column based on the values in two others, I would suggest you to check the "Calculated Column" WPF Demo.
Please check it and let me know if you have any further questions.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.