I Have a XamDataGrid and i am adding dynamic columns .
Able to add the columns but when i try edit the text in the column it is not firing DatGrid edit event
Please help me on how to trigger fire event when enter data in text box
Grid Design
<igDP:XamDataGrid Grid.Row="3" Name="SubmissionGrid" Margin="5,5,5,5" Style="{StaticResource EventCreationXamDGStyle}" RecordsDeleting="SubmissionGrid_RecordsDeleting" DataValueChanged="SubmissionGrid_DataValueChanged" EditModeStarting="SubmissionGrid_EditModeStarting" EditModeStarted="SubmissionGrid_EditModeStarted" EditModeEnding="SubmissionGrid_EditModeEnding" RecordAdded="SubmissionGrid_RecordAdded" KeyUp="SubmissionGrid_KeyUp" RecordsDeleted="SubmissionGrid_RecordsDeleted" RecordAdding="SubmissionGrid_RecordAdding" > <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:CellValuePresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" Value="Rec #"> <Setter Property="HorizontalContentAlignment" Value="Center"/> </DataTrigger> </Style.Triggers> </Style> </igDP:XamDataGrid.Resources> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AllowAddNew="True" AllowDelete="True" AddNewRecordLocation="OnBottom" AutoGenerateFields="False" AutoArrangePrimaryFieldReservation="None"/> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:UnboundField Name="deleteField" Width="40"> <igDP:UnboundField.Settings> <igDP:FieldSettings AllowResize="False" AllowGroupBy="False" AllowRecordFiltering="False" AllowSummaries="False" CellMaxWidth="20" CellValuePresenterStyle="{StaticResource deleteButtonforEventCreationStyle}"/> </igDP:UnboundField.Settings> </igDP:UnboundField> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
Adding dynamic columns with below code
Here is the cellpresentervalue style
Hitested and it works well as per my requirement.Thanks
Hi Chakradar
Sure, please, take your time to test the suggested approach and let me know if it helps.
Best regards, Bozhidara Pachilova
Thanks for the update.
I will try this and let you know
Hello Chakradar,
After discussing this matter with the Ultimate UI for WPF dev team, a workaround solution that has been suggested is the following:
The EditorStyle property of the target Field could be set, instead of the CellValuePresenter style. This style has to target a control inheriting the ValueEditor class, such as the XamTextEditor. This is because the grid communicates with a value editor during an edit operation.
The approach involves copying the default style of the XamTextEditor and altering its “EditTemplate” ControlTemplate, by for instance, adding a button, as in your original CellValuePresenter style.
The default style of the XamTextEditor could be found under:
"C:\Program Files (x86)\Infragistics\*your version*\WPF\DefaultStyles\Editors\EditorsGeneric_Express.xaml"
Please, note, that in case your app uses any of our themes, the target xaml file is other from the same directory. For example for the “Office2010Blue” theme, it would be
"C:\Program Files (x86)\Infragistics\*your version*\WPF\DefaultStyles\Editors\EditorsOffice2010Blue_Express.xaml"
Attached you will find a sample demonstrating this suggestion. There is added the CustomXamTextEditorStyle.xaml resource dictionary, containing the altered default style. The modification starts from line 85, and as you will see a button is added to the edit template. If needed, the “Template” could also be altered to contain a button.
As you will see, editing a cell of that field triggers the editing events as expected.
In conclusion, please, consider this approach as well.
Associate Software Developer
XDGEdit3.zip
Please, keep in mind that according to our Product Lifecycle Page, version 13.1 of Ultimate UI for WPF is long expired and is not eligible for Developer Support Services.
In order to take advantage of all introduced fixes, improvements and features since then, including support, my suggestion is to consider upgrading to any of the supported versions.
Consequently, I am afraid a workaround solution for version 13 cannot currently be provided, as this is also considered out of our support services. As a last resort option, I could suggest implementing an application-level logic that would update your data model upon editing the TextBox within the custom CellValuePresenter template. For example keyboard/mouse events could be used. However, this should be implemented entirely on application-level.