TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Roberto Salemi
NA
146
141.1k
[WPF] DataGrid and Refresh during AddNew o EditItem
May 12 2015 6:19 AM
Hi,
in my DataGrid, the user can add a new row with a button that add an empty item in collection that is in bind with DataGrid.
The first column of DataGrid is a CheckBox Column, if the user add a NewRow and click on CheckBox Column for select/deselect all items I have an error:
"'Refresh' non consentito durante una transazione AddNew o EditItem."
My code is:
private void HeadCheck(object sender, RoutedEventArgs e, bool IsChecked)
{
var items = dgPlan.Items.OfType<AnalysisPlanItemExt>();
foreach (var item in items)
{
item.IsChecked = IsChecked;
}
try
{
dgPlan.Items.Refresh();
}
catch (Exception ex)
{
dgPlan.CancelEdit(DataGridEditingUnit.Row);
dgPlan.Items.Refresh();
}
}
I added a try-catch but the error there is still.
Thanks.
Reply
Answers (
1
)
[WPF] Xaml Language: can insert tag strong / bold?
Binding an Icon of MenuItem in WPF