Hi All,
I am working on WPF application,Here i am trying to change the value based on combobox selection in datagrid.But if i click on cell(double click or single click) i am not getting the combobox.
I am using the below code.
<DataGrid Grid.Row="1" Grid.Column="3" x:Name="fieldGrid"
AutoGenerateColumns="False" GridLinesVisibility="None" AllowDrop="True" Drop="__fieldGrid_Drop" PreviewDrop="__fieldGrid_PreviewDrop">
<DataGrid.Columns >
<DataGridTemplateColumn Header="Source Table Columns" Width="*"
CanUserResize="True" IsReadOnly="True" CanUserSort="True" SortMemberPath="ColumnName"
CellTemplate="{StaticResource DataSourceCellTemplate2}" CellEditingTemplate="{StaticResource EditingDateTemplate}" SortDirection="Ascending"/>
</DataGrid.Column>
</DataGrid>
and i created CellTemplate and CellEditingTemplate seperately.that code is below.
<datatemplate x:key="DataSourceCellTemplate2">
<stackpanel orientation="Horizontal" margin="1,3">
<textblock name="dsFieldText2" text="{Binding Value}">
<datatemplate x:key="EditingDateTemplate">
<stackpanel orientation="Horizontal" margin="1,3">
<combobox>
If i click on cell even i am not getting empty combobox.
Anyone could you please help me.
What I have tried:
I have been tried so many articles.I have used the below code
<DataGridTemplateColumn Header="">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
Text="{Binding ComponentIdentifier,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=ApplicableIdentifiers, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ComponentIdentifier}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
If i used this code the i am getting this error edititem is not allowed for this view in wpf datagrid