Hi there,
is it possible to check if a Cell in the XamdataGrid isEnabled in another way as with the CellValuePresenter.FromCell(cell).IsEnabled?
Because i have the Problem that my grid is very large and if i edit the header of my grid all cells in the columns should apply the value in the header but just if the cell is enabled. And when the column is longer than my screen i can´t check the isEnabled property of some cells because they are not in view. But i have to know the isEnabled-Property.
Do you have any idea?
regards
Cloud
nobody knows how i get the .IsEnabled Property of a Cell?
Hello Cloud,
Thank you for contacting our community.
I have been looking into your post but I will need more details about how you set the cell’s IsEnabled property so that I could provide you with a better solution. Also I could suggest you to have a look at the sample in this forum thread where a property is defined to check if the record is read only. If the property is set to true the CellValuePresenter IsEnabled property is set to true. By defining a property to check if the cell is read only, you could get its value no matter if the cell is in view or not.
i set my isenabled Property of the Cell with a Converter like this:
<grid.resources>
<Style x:Key="enabledStyle" TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="IsEnabled" Value="{Binding DataItem, Converter={StaticResource worktimeConverter}}"></Setter> </Style>
</grid.resources>
and here my converter code:
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value != null) { DataRowView rowView = (DataRowView)value; if (rowView.Row.Table.ParentRelations.Count > 0) { if (rowView.Row.ItemArray[1].ToString() == "0") { return Util.CheckWorktime(rowView.Row.ItemArray[3].ToString(), (int)(rowView.Row.ItemArray[0])); } } } return true; }
if you need further information to help me please let me know.
cloud
I am just checking your progress on the issue.
If you require any further assistance, please do not hesitate to ask.
Thank you for the details. What I could suggest you here is instead of using the IsEnabled property of the CellValuePresenter to handle the CellUpdating event. In its body you could check if the cells in the field where you want to apply the changes meet the desired conditions and if they do, you can change their value. Here Andrew has explained in details why the IsEnabled property is not an appropriate choice when there is a virtualization.
Please feel free to ask if you have any questions on the matter.