Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
XamComboEditor in XamDataGrid: Grid Cell on retaining XamcomboEdior Selection
posted

Hi,

I need to dynamically update values in cell drop down, which can be different for two cells of same column. E.g. In first row inside Workbook column drop down I need to show four workbook names(A,B,C,D) and in second row inside workbook column drop down I need to show three workbooks(X,Y,Z). So, I have added xamcomboeditor in "WorkBook" column of xamDataGrid programatically.

Whenever i select item from a drop down in workbook cell, the selection is lost after focused is  removed from that cell. Also, the data source attached to grid is not updated with selected value. I have attached a project sample and attached two images of the issue in same project. Please let me know how I can retain the selection of xamcomboeditor in this case and update it in data source of grid.

Thanks,

Sagar

WpfApplication7.rar
Parents
No Data
Reply
  • 17475
    Offline posted

    Hello Sagar,

    In the XamdataGridBehavior the XamComboEditor.SelectedItem property is bound to the Workbook field value which is not set unless the cell exit edit mode so the SelectedItem is actually set to null. To bind the XamComboEditor.SelectedItem you can use the (igWPF:TemplateEditor.Editor).Value binding:

    SelectedItem="{Binding Path=(igWPF:TemplateEditor.Editor).Value, RelativeSource={RelativeSource Self}, UpdateSourceTrigger=PropertyChanged}"

    Or use the help class TemplateEditorValueBinding by adding the namespace xmlns:igWPF="http://schemas.infragistics.com/xaml/wpf":

    SelectedItem="{igWPF:TemplateEditorValueBinding}"

    The same help class binding could be used for the TextBlock binding as well:

    <TextBlock Text="{igWPF:TemplateEditorValueBinding}" />

    The approach described above will set the selected item without using the XamdataGridBehaviour. I have modified the sample project to illustrate it.

    Let me know if you have any other questions.

    WpfApplication7(2).zip
Children
No Data