Hello there,
I just tried to use the WPF GridView control. But I ran into a very weird issue.
Repro steps:
1. Double click a cell to enter edit mode
2. You changed the cell but then dobule click a cell in another row
3. You expect that the previous row will save the change
4. But now you get the exception see the attached image.
I can't repro this every time. What I feel is that if I run this in a lowend machine (2G memory), it will occur much often than a highend machine.
Any help will be highly appreicated.
David
I just tried to use the WPF GridView control. But I ran into a very weird issue.
Repro steps:
1. Double click a cell to enter edit mode
2. You changed the cell but then dobule click a cell in another row
3. You expect that the previous row will save the change
4. But now you get the exception see the attached image.
I can't repro this every time. What I feel is that if I run this in a lowend machine (2G memory), it will occur much often than a highend machine.
Any help will be highly appreicated.
David
6 Answers, 1 is accepted
0
Hi David,
We tried to reproduce the described exception but to no avail. Can you give us more details about your grid - is there sorting/ grouping applied when this exception appears ? Any additional details about the grid and the scenario will be plus. Also, you may try to reproduce it on our online demos . Thank you.
Best wishes,
Yordanka
the Telerik team
We tried to reproduce the described exception but to no avail. Can you give us more details about your grid - is there sorting/ grouping applied when this exception appears ? Any additional details about the grid and the scenario will be plus. Also, you may try to reproduce it on our online demos . Thank you.
Best wishes,
Yordanka
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0

David
Top achievements
Rank 1
answered on 20 Jan 2011, 07:44 PM
<
telerik:RadGridView
Name
=
"radGridView1"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding ItemsSource}"
AddingNewDataItem
=
"radGridView1_AddingNewDataItem"
RowEditEnded
=
"radGridView1_RowEditEnded"
ShowGroupPanel
=
"False"
SelectionMode
=
"Multiple"
MinHeight
=
"200"
SelectionChanged
=
"radGridView1_SelectionChanged"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewSelectColumn
Tag
=
"{Binding DeviceID}"
UniqueName
=
"DeviceID"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding DeviceType}"
UniqueName
=
"DeviceType"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding DeviceKey}"
UniqueName
=
"DeviceKey"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding DeviceIDCNo}"
UniqueName
=
"DeviceIDCNo"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding InStockDate}"
UniqueName
=
"InStockDate"
DataFormatString
=
"{}{0:d}"
>
<
telerik:GridViewDataColumn.FilteringControl
>
<
local:DateFilterControl
/>
</
telerik:GridViewDataColumn.FilteringControl
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Invoice}"
UniqueName
=
"Invoice"
/>
<
telerik:GridViewComboBoxColumn
DataMemberBinding
=
"{Binding DeviceStatus}"
UniqueName
=
"DeviceStatus"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding isRegistered}"
UniqueName
=
"isRegistered"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding isSpecialIDC}"
UniqueName
=
"isSpecialIDC"
IsReadOnly
=
"True"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
<
telerik:RadDataPager
Name
=
"radDataPager1"
PageSize
=
"6"
DisplayMode
=
"FirstLastPreviousNextNumeric"
Source
=
"{Binding Items,ElementName=radGridView1}"
/>
Thank you for the prompt response.
I understand that it is not easy to repro. Above is my xaml declare of the gridview and datapager. And below is what I believe that could be the cause of the assertion.
Everytime, when I finish the update/edit, I will rebind the datasource. I know this is not the best practise. I didn't implement the INotifyChange Interface for my model for other reasons. I just simply rebind/refresh the datasource after every update.
private void radGridView1_RowEditEnded(object sender, WiseLinkWPF.Windows.Controls.GridViewRowEditEndedEventArgs e)
{
if (e.EditAction == GridViewEditAction.Cancel)
{
return;
}
if (e.EditOperationType == GridViewEditOperationType.Insert)
{
//Add the new entry to the data base.
dm.Insert(e.NewData as DeviceData);
}
else if (e.EditOperationType == GridViewEditOperationType.Edit)
{
dm.Update(e.EditedItem as DeviceData);
}
this.radGridView1.Rebind();
this.radGridView1.ShowInsertRow = false;
}
Another place could be wrong will be my grid selection event.
private void radGridView1_SelectionChanged(object sender, WiseLinkWPF.Windows.Controls.SelectionChangeEventArgs e)
{
if (e.AddedItems.FirstOrDefault() != null)
{
this.radGridView1.CurrentItem = e.AddedItems.First();
}
}
0
Hi David,
Thank you for the provided code.
We have looked on it but we are not quite sure what exactly Insert() and Update() methods do. Can you clarify a little more? Another part of the code that may cause the problem is calling Rebind() on each raising of RowEditEnded event. May you try to comment it and see if you still get the exception. If not, please explain why you need to call Rebind() in this way. Knowing more about your goals we could suggest better approach for achieving them.
Also, if it is possible for you to send a sample application reproducing the problem will be of great help. You can do this by opening a support ticket and attach it there.
Kind regards,
Yordanka
the Telerik team
Thank you for the provided code.
We have looked on it but we are not quite sure what exactly Insert() and Update() methods do. Can you clarify a little more? Another part of the code that may cause the problem is calling Rebind() on each raising of RowEditEnded event. May you try to comment it and see if you still get the exception. If not, please explain why you need to call Rebind() in this way. Knowing more about your goals we could suggest better approach for achieving them.
Also, if it is possible for you to send a sample application reproducing the problem will be of great help. You can do this by opening a support ticket and attach it there.
Kind regards,
Yordanka
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0

David
Top achievements
Rank 1
answered on 21 Jan 2011, 05:56 PM
Yordanka,
The Insert and Update just normal SQL Entity Framework code that do the CRUD for database.
The reason we do the rebind after every edit is that this program is to monitor the status of running vehicle which require real time status update as quick as possible. And there are more than one agent could modify the vehicle status in different PCs. (They won't delete the vehicle though.)
I can send you the sample project but I am afraid that it won't help repro in your machine easily. I deployed my application to 4 agent PCs.
One machine never get the exception ( Windows 7, 4 G memory, duo core)
Two machines get the exception occationaly (Windows XP SP3+.NET Framework 4, 4G memory, single core)
One machine (low end/legacy) run into the issue quite often. (Windows XP SP3+.NET Framework 4, 2G memory, single core)
Thx,
David
The Insert and Update just normal SQL Entity Framework code that do the CRUD for database.
The reason we do the rebind after every edit is that this program is to monitor the status of running vehicle which require real time status update as quick as possible. And there are more than one agent could modify the vehicle status in different PCs. (They won't delete the vehicle though.)
I can send you the sample project but I am afraid that it won't help repro in your machine easily. I deployed my application to 4 agent PCs.
One machine never get the exception ( Windows 7, 4 G memory, duo core)
Two machines get the exception occationaly (Windows XP SP3+.NET Framework 4, 4G memory, single core)
One machine (low end/legacy) run into the issue quite often. (Windows XP SP3+.NET Framework 4, 2G memory, single core)
Thx,
David
0
Accepted
Hello David,
Could you try to rebind the grid using Dispatcher:
this.Dispatcher.BeginInvoke(new Action(() => this.albumsGridView.Rebind()));
In case this doesn't help, please attach your sample project so that we can provide you with further assistance.
Greetings,
Yordanka
the Telerik team
Could you try to rebind the grid using Dispatcher:
this.Dispatcher.BeginInvoke(new Action(() => this.albumsGridView.Rebind()));
In case this doesn't help, please attach your sample project so that we can provide you with further assistance.
Greetings,
Yordanka
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0

David
Top achievements
Rank 1
answered on 26 Jan 2011, 09:14 PM
I would say that the dispatcher do the magic for us. After I apply the code as your suggested. It works well. Thx a lot of the help.
David
David