Click here to Skip to main content
13,905,154 members
Rate this:
Please Sign up or sign in to vote.
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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190306.1 | Last Updated 13 Aug 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100