Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
Register
Login
3
Reply
[WPF] DataGrid Read Only but not for new row
Roberto Salemi
Apr 17 2015 9:11 AM
1.6k
Reply
Hi,
I have a DataGrid (called dgSample), where I set IsReadOnly="True".
User can add a new Row, this row must be editable.
So in my model I set a property:
[DefaultValue(false)]
public virtual bool IsNewItem { get; set; }
where user add new row I set this property to true
So in my DataGrid I have:
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsNewItem}" Value="True">
<Setter Property="IsReadOnly" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
but the last Row is not editable, why?
Thanks.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
[WPF] DataGrid: apply style to text into cell from codebehin
[WPF] DataGrid Cell Style: Textdecoration Strikethrough