0

I have a problem to edit a row in XCeed WPF DataGrid. When the user focused a cell, the editing symbol appears, but he can not insert anything. In XAML is this stuff

<xcdg:DataGridCollectionViewSource x:Key="DataGridSource"  Source="{Binding ActorsCollection, UpdateSourceTrigger=PropertyChanged}"/>

<xcdg:DataGridControl Name="GridControl" Grid.Row="1" ItemsSource="{Binding ActorView}" SelectedItem="{Binding CurrentActor}"
                      AutoCreateColumns="True" ReadOnly="{Binding IsDataGridReadOnly, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,5">
  <xcdg:DataGridControl.View>
    <xcdg:TableflowView UseDefaultHeadersFooters="False">
      <xcdg:TableView.Theme>
        <xcdg:RoyaleNormalColorTheme/>
      </xcdg:TableView.Theme>

      <xcdg:TableflowView.FixedHeaders>
        <DataTemplate>
          <xcdg:ColumnManagerRow/>
        </DataTemplate>
      </xcdg:TableflowView.FixedHeaders>
    </xcdg:TableflowView>
  </xcdg:DataGridControl.View>

  <xcdg:DataGridControl.ContextMenu>
    <ContextMenu>
      <MenuItem Header="{StaticResource ViewGenreContextMnuDelete}" Command="{Binding DeleteActorCommand}">
        <MenuItem.Icon>
          <Image Source="/Resources/delete.png" Height="16" Width="16"/>
        </MenuItem.Icon>
      </MenuItem>
    </ContextMenu>
  </xcdg:DataGridControl.ContextMenu>

  <xcdg:DataGridControl.DefaultCellEditors>
    <xcdg:CellEditor x:Key="{x:Type s:String}">
      <xcdg:CellEditor.EditTemplate>
        <DataTemplate>
          <TextBox Text="{xcdg:CellEditorBinding}"/>
        </DataTemplate>
      </xcdg:CellEditor.EditTemplate>
    </xcdg:CellEditor>

    <xcdg:CellEditor x:Key="{x:Type s:Int32}">
      <xcdg:CellEditor.EditTemplate>
        <DataTemplate>
          <xctk:DecimalUpDown Value="{xcdg:CellEditorBinding}"/>
        </DataTemplate>
      </xcdg:CellEditor.EditTemplate>
    </xcdg:CellEditor>

    <xcdg:CellEditor x:Key="{x:Type s:DateTime}">
      <xcdg:CellEditor.EditTemplate>
        <DataTemplate>
          <xctk:DateTimePicker Value="{xcdg:CellEditorBinding}"/>
        </DataTemplate>
      </xcdg:CellEditor.EditTemplate>
    </xcdg:CellEditor>
  </xcdg:DataGridControl.DefaultCellEditors>

  <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName="Firstname" Title="{StaticResource ViewDubbingActorGridColumnFirstName}" MinWidth="180"/>
    <xcdg:Column FieldName="Lastname" Title="{StaticResource ViewDubbingActorGridColumnLastName}" MinWidth="180"/>
    <xcdg:Column FieldName="AdditionalName" Title="{StaticResource ViewActorGridAdditionalName}" MinWidth="200"/>
    <xcdg:Column FieldName="AdditionalInformation" Title="{StaticResource ViewActorGridAdditionalInformation}" MinWidth="250"/>
    <xcdg:Column FieldName="Born" Title="{StaticResource ViewActorGridBorn}" MinWidth="180"/>
    <xcdg:Column FieldName="Dead" Title="{StaticResource ViewActorGridDead}" MinWidth="180"/>
    <xcdg:Column FieldName="Bornlocation" Title="{StaticResource ViewActorGridBornlocation}" MinWidth="180"/>
    <xcdg:Column FieldName="Deadlocation" Title="{StaticResource ViewActorGridDeadlocation}" MinWidth="180"/>
  </xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>

The DataSource of Grid is a CollectionView to filter, group etc. When I set the property AutoCreateColumns to true, than is works and the user can edit the row. Has anyone any suggestions?

A other question is, when the user opens the DateTime picker, there is a very strange year (0001), is it possible to set a default datetime, for example DateTime.Now? Thank you.

simmeone
  • 629
  • 6
  • 18

0 Answers0