Hi,
I'm experiencing some issues with Observablecollection<T> bound to the RadGridView.
As long as I'm inserting or deleting items in the Collection it updates just fine, but if I try to
update an item with a new value, the GridView doesn't do anything.
What I have is this:
which I then bind to the grid using
When an update occurs it's just a simple iteration over the Collection like this:
The object looks like this:
Yet, if I update any value in the observablecollection, as previously mentioned, nothing updates in the UI of the grid.
The main reason I use observablecollection is to have the grid update only the items and properties needed, not rebind
the whole grid (which can be a couple of 1000 items at a time) which would ruin the grouping, sorting and so on and incur
a break in the work process for the people using the program.
How can I make the gridview update on value changes in the items?
Thanks in advance. :)
//Johannes
I'm experiencing some issues with Observablecollection<T> bound to the RadGridView.
As long as I'm inserting or deleting items in the Collection it updates just fine, but if I try to
update an item with a new value, the GridView doesn't do anything.
What I have is this:
ObservableCollection(OverviewData) ocOverviewData =
new
ObservableCollection(OverviewData);
which I then bind to the grid using
rgvItems.ItemSource = ocOverviewData;
When an update occurs it's just a simple iteration over the Collection like this:
foreach
(OverviewData d
in
ocOverviewData)
{
if
(d.ReceiverName != newValue)
{
d.ReceiverName = newValue;
}
}
The object looks like this:
public
class
OverviewData : INotifyPropertyChanged
{
private
string
_ReceiverName;
public
string
ReceiverName
{
get
{
return
_ReceiverName; }
set
{
if
(_ReceiverName == value)
return
; _ReceiverName = value;
OnPropertyChanged(
new
PropertyChangedEventArgs(
"ReceiverName"
));
}
}
private
string
_ReceiverAddress;
public
string
ReceiverAddress
{
get
{
return
_ReceiverAddress; }
set
{
if
(_ReceiverAddress == value)
return
; _ReceiverAddress = value;
OnPropertyChanged(
new
PropertyChangedEventArgs(
"ReceiverAddress"
));
}
}
public
event
PropertyChangedEventHandler PropertyChanged;
public
void
OnPropertyChanged(PropertyChangedEventArgs e)
{
if
(PropertyChanged !=
null
)
PropertyChanged(
this
, e);
}
}
Yet, if I update any value in the observablecollection, as previously mentioned, nothing updates in the UI of the grid.
The main reason I use observablecollection is to have the grid update only the items and properties needed, not rebind
the whole grid (which can be a couple of 1000 items at a time) which would ruin the grouping, sorting and so on and incur
a break in the work process for the people using the program.
How can I make the gridview update on value changes in the items?
Thanks in advance. :)
//Johannes