I have seen a few posts on specific columns that can be set to always be in edit mode. Is there a way to set a TemplateColumn to always be in edit mode?
Hi Gary,
I hope my response was helpful. Please let me know if you have any questions.
The answer is yes. I created a templatecolumn with separate ItemTemplate and EditorTemplate each bound to a property in my viewmodel that implements INotifyPropertyChanged.
You’ll notice that the ItemTemplate is a TextBlock and the EditorTemplate is a TextBox.
<ig:TemplateColumn Key="UnitPrice" >
<ig:TemplateColumn.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding UnitPrice}" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"/>
</DataTemplate>
</ig:TemplateColumn.ItemTemplate>
<ig:TemplateColumn.EditorTemplate>
<TextBox Text="{Binding UnitPrice, Mode=TwoWay, UpdateSourceTrigger=Explicit}" HorizontalAlignment="Center"/>
</ig:TemplateColumn.EditorTemplate>
</ig:TemplateColumn>
Then I used the Editing settings for the grid and set the IsOnCellActiveEditingEnabled to true and IsMouseActionEditingEnabled to SingleClick so that as soon as you mouse click or tab into the cell, it is in edit mode. I also set AllowEditing to Cell although you may want to use Row.
Please let me know if that helps you.