Hi,
i would like to customize a colum of my Grid. If i set AllowEdit in the FieldSettings the whole colum is ReadOnly.
I would like to allow Edit for new Rows but not for existing ones. So i tried to trigger the EditModeStarting event for the colum but the Code doesn't execute.
Here is the Code for the Colum and its Resources:
<Style x:Key="FahrzeugartFieldStyle" TargetType="{x:Type igDE:XamComboEditor}"> <EventSetter Event="EditModeStarting" Handler="FZArtSelectedItemChanged"/> <Setter Property="ValuePath" Value="FA_ID" /> <Setter Property="DisplayMemberPath" Value="FA_Bezeichnung" /> <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=src:BASE},Path=_CRM.FAHRZEUG_ART, Mode=OneWay}" /> </Style>
<igDP:Field Name="FZ_FA_ID" Label="Fahrzeugart" Width="120"> <igDP:Field.Settings> <igDP:FieldSettings EditorStyle="{StaticResource FahrzeugartFieldStyle}" /> </igDP:Field.Settings> </igDP:Field>
Thank you for your support.
Thank you for your support. The second answer worked fine for me. Here ist the Code I triggered my requierys with:
private void dg_Fahrzeug_EditModeStarting(object sender, Infragistics.Windows.DataPresenter.Events.EditModeStartingEventArgs e) { if(e.Cell.Field.Name == "FZ_FA_ID") { if (e.Cell.Record.IsAddRecord == false) { e.Cancel = true; } } }
You can also use the EditModeStarting event and cancel it (e.Cancel = true) if the cell is not in the AddNewRecord.
We have similar requirements. We did it in code by setting IsEnabled property in cellValuePresentor.Editor.