Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
WPf Datagrid. I have a button in the view; when I click it. It insert the new blank row in the grid.

public ObservableCollection<MyModel> GridCollection { get; set; }
public void AddNewRow()
    GridCollection.Insert(0, new MyaModel());

My requirement is that I want all the cells in the first row, either a textbox or combobox. The rest rows in the grid are still readonly only.
                    <TextBox Text="{Binding Name}">
                            <Style TargetType="TextBox">
                                      <DataTrigger Binding="{Binding EditVisibility" Value="Visible">
                                         <Setter Property="IsReadOnly"  Value="True" />

What I have tried:

I use the
to trigger the style, but it applyed to all rows.

Maybe I have to use behavior or CellEditingTemplate?
Updated 12-Aug-18 18:35pm

1 solution

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900