Home Forums WPF controls Xceed DataGrid for WPF I can’t enter the cell editor if the bound value is null

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #26741 |

    I use a DataGridCollectionView as ItemsSource.
    In this ItemsSource, I have 3 string fields. In my datagrid, I have 3 columns.
    My datagrid EditTriggers and CellEditorDisplayConditions properties are set both to CellIsCurrent.

    The weird behaviour is that I can edit all the cells by clicking on it but if a cell is bound to a null value is the ItemsSource, I’m not able to enter the edit mode.
    I can workaround this by removing the null values from my itemsSource and change them to String.Empty values.

    Has anybody the same behaviour ?

    Imported from legacy forums. Posted by Julien (had 3604 views)

    Xceed Support
    Member
    Post count: 5658

    Have you defined ItemProperties in the DataGridCollectionViewSource? If so, and the fieldss of the objects contained in your data source do not have a specific type (object), then the grid will not be able to determine what editor to use when a null value appears and therefore not allow the cell to be edited.

    That said, you can either explicitly set each column’s CellEditor or specify the type of each column through the DataGridItemProperties.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 231 views)

    User (Old forums)
    Member
    Post count: 23064

    The ItemProperties of the DataGridCollectionViewSource seem to have been automatically filled when I created its instance given my BindingList. I’ve checked the DataGridItemProperty one by one and all the data types are correct (all System.String).

    I have also manually set the column’s CellEditor and then I can enter the edit mode of the cells. But in this case, the cell editor is different from the default one (I have used a DataTemplate with only an AutoSelectTextBox).

    Why are the default cell editors not triggered when null value is set ?

    Imported from legacy forums. Posted by Julien (had 523 views)

    Xceed Support
    Member
    Post count: 5658

    Have you set the AutoCreateColumns property to false? If so, the default editors are not automatically created resulting in their “on-the-fly” creation when a cell enters edit mode. In this case, null values will not be handled.

    If you want to explicitly set a cell editor, you can use the static instances on the CellEditor class.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 271 views)

    User (Old forums)
    Member
    Post count: 23064

    Yes, I had set the AutoCreateColumns property to false.
    Now, I set explicitly the cell editor with the static instances and it works perfectly.

    Thank you for your support !

    Imported from legacy forums. Posted by Julien (had 3937 views)

    User (Old forums)
    Member
    Post count: 23064

    I am trying t do this as well (I am new to Xceed DataGrid) can you give me an example of how to specify a static instance for a cell editor? At the moment I have string and numeric fields.

     

    Imported from legacy forums. Posted by Mark (had 542 views)

    User (Old forums)
    Member
    Post count: 23064

    It’s ok, I figured it out.

    CellEditor=”{x:Static xdg:CellEditor.TextBoxEditor}”

    This WPF stuff requires a whole new way of thinking – again – sigh! 

    Imported from legacy forums. Posted by Mark (had 1205 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.