CurrentCellValueChanged on GridDataTemplateColumn

Hello Syncfusion,

I have a GridDataTemplateColumn like this :

var cTmp = new DataTemplate { VisualTree = txtBlck };
var eTmp = TemplateHelper.GetTemplateForEnum(property, colName);

var colap = new GridTemplateColumn
                                    {
                                        MappingName = colName,
                                        HeaderText = headerText,
                                        CellTemplate = cTmp,
                                        EditTemplate = eTmp,
                                        ColumnSizer = GridLengthUnitType.Auto,
                                        AllowResizing = true
                                    };


public DataTemplate GetTemplateForEnum(Type type, string propertyName)
        {
            var elmtFct = new FrameworkElementFactory(typeof(ComboBox));

            elmtFct.SetBinding(
                ItemsControl.ItemsSourceProperty,
                new Binding(propertyName)
                    {
                        Converter = new ComboBoxEnumConverter(),
                        ConverterParameter = type,
                        Mode = BindingMode.OneTime
                });

            elmtFct.SetBinding(
                Selector.SelectedValueProperty,
                new Binding(propertyName)
                    {
                        Mode = BindingMode.TwoWay,
                        UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                        NotifyOnTargetUpdated = true
                    };
 
            elmtFct.SetValue(FocusManagerHelper.WantsKeyInputProperty, true);
            elmtFct.SetValue(FocusManagerHelper.FocusedElementProperty, true);

            return new DataTemplate { VisualTree = elmtFct };
        };

The thing is I would like to trigger CurrentCellValueChanged on the propertychanged event from biding => SelectedValueProperty of combobox .
But, the CurrentCellValueChanged triggers only when de CurrentCell is changed.

Can you tell me how can I trigger without changing cell please ? I'm stuck.

Many Thanks.

Alexandre Leclerc.

5 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team October 25, 2017 04:05 AM UTC

Hi  Leclerc, 
 
Thank you for contacting Syncfusion support. 
 
We have analyzed your query. Could you please share some information about your requirement as like, 
    1. While changing any of the cell value means, the CurrentCellValueChanged event only triggered. Could you please confirm, for what purpose you like to trigger the CurrentCellValueChanged event for the combobox selection change? 
    2.  Could you please share your ComboBoxEnumConverter() code and TemplateHelper class file. 
 
If you shared these details, this would be more helpful for us to update the solution as the earliest. 
 
Regards, 
Muthukumar K 



LA Leclerc Alexandre October 25, 2017 07:25 AM UTC

Hello Muthukumar,

I'd like to trigger the CurrentCellValueChanged event to check a checkbox which matches to selected row who is editing.
I join you the classes you need.

Thanks.


Attachment: Files_fe987d8f.zip


MK Muthukumar Kalyanasundaram Syncfusion Team October 29, 2017 12:30 PM UTC

Hi Leclerc, 
 
Thanks for the update. 

We have analyzed your query. The CurrentCellValueChanged and CurrentCellValidated event are not supported for GridTemplateColumn. As template column can be loaded with any UIElements. You can use CurrentCellActivated event. Within this event, you can get the currentcell of GridTemplateColumn in grid. Please refer the below code snippet, 
 
C#: 
Void datagrid_CurrentCellActivated(objectsender,CurrentCellActivatedEventArgsargs) 
{ 
// you can do code here 
} 
 
You can use PropertyChanged event instead of CurrentCellValueChanged to get value change notification. Please make use of below code snippet, 
 
this.datagrid.View.PropertyChanged += View_PropertyChanged; 
voidView_PropertyChanged(objectsender, System.ComponentModel.PropertyChangedEventArgse) 
{ 
// you can do code here 
} 
 
Please find the sample in the below location and let us know if this helps you. 
 
Please let us know if you have any concerns. 
 
Regards, 
Muthukumar K 



LA Leclerc Alexandre October 30, 2017 08:20 AM UTC

Hello Muthukumar,

Thanks, I will try this soon, I will keep you update.

Have a nice day.


Alexandre Leclerc.



MK Muthukumar Kalyanasundaram Syncfusion Team October 31, 2017 04:50 AM UTC

Hi Leclerc, 
 
Thanks for the update. We will wait to hear from you.  
 
Regards, 
Muthukumar K 


Loader.
Up arrow icon