WPF DataGrid with ArcGIS Pro SDK Style does not allow to edit cells

1015
1
03-11-2019 08:31 AM
KarlHuber
New Contributor III

We use a WPF DataGrid inside a ArcGIS Pro Pane with custom styling as suggested by the ArcGIS Pro SDK Style Guide But if we declare our DataGrid like this, all cells become disabled.

<DataGrid Grid.Row="3"
          ItemsSource="{Binding Path=SelectedMember.PropertyDefinitions}"
          Style="{DynamicResource Esri_DataGrid}"
          ColumnHeaderStyle="{DynamicResource Esri_DataGridColumnHeader}"
          CellStyle="{DynamicResource Esri_DataGridCell}"
          AlternatingRowBackground="LightGray"
          CanUserAddRows="True"
          CanUserDeleteRows="True"
          AutoGenerateColumns="False">
    <DataGrid.Columns>
        <DataGridTextColumn Header="Name" Binding="{Binding Path=Name}"></DataGridTextColumn>
        <DataGridTextColumn Header="Display Name" Binding="{Binding Path=DisplayName}"></DataGridTextColumn>
        <DataGridTextColumn Header="Category" Binding="{Binding Path=Category}"></DataGridTextColumn>
        <DataGridTemplateColumn Header="Column">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Column}"></TextBlock>
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
            <DataGridTemplateColumn.CellEditingTemplate>
                <DataTemplate>
                    <ComboBox ItemsSource="{Binding Columns}" SelectedItem="{Binding Column}"></ComboBox>
                </DataTemplate>
            </DataGridTemplateColumn.CellEditingTemplate>
        </DataGridTemplateColumn>
        <DataGridCheckBoxColumn Header="Visible" Binding="{Binding Path=IsVisible}"></DataGridCheckBoxColumn>
        <DataGridCheckBoxColumn Header="Read Only" Binding="{Binding Path=IsReadOnly}"></DataGridCheckBoxColumn>
    </DataGrid.Columns>
</DataGrid>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

There's no chance to edit a cell value by double clicking anymore. Do we miss something? If we do not set custom styles everything works like we would like to have it...

0 Kudos
1 Reply
MatthewDriscoll
MVP Regular Contributor

Try adding to the DataGrid

IsReadOnly="False"