I have a RadGridView bound to a collection containing rows like the following:
My grid has 4 columns bound to each of the Deal properties, with bindings such as 'Deal.Id', 'Deal.ReceivedTime', etc.
All displays correctly, but when I call the UpdateBookingStatus method, which updates a couple of Deal properties and then fires a PropertyChanged event on the Deal itself, the Deal.BookingTime and Deal.IsBooked column values are not always refreshed in the grid. If I scroll the relevant rows out of view and then back into view, the values are updated correctly.
Is this expected? Am I not supposed to be setting nested bindings on Columns? Should the grid not listen for the
Thanks.
Marcus.
public
class
RowViewModel : INotifyPropertyChanged
{
public
RowViewModel(Deal deal)
{
Deal = deal;
}
public
Deal Deal {
get
;
private
set
; }
public
event
PropertyChangedEventHandler PropertyChanged;
public
void
UpdateBookingStatus()
{
Deal.IsBooked =
true
;
Deal.BookingTime = DateTime.UtcNow;
OnPropertyChanged(
"Deal"
);
}
protected
virtual
void
OnPropertyChanged(
string
propertyName)
{
var handler = PropertyChanged;
if
(handler !=
null
)
handler(
this
,
new
PropertyChangedEventArgs(propertyName));
}
}
public
class
Deal
{
public
string
Id {
get
;
private
set
; }
public
DateTime ReceivedTime {
get
;
private
set
; }
public
DateTime? BookingTime {
get
;
set
; }
public
bool
IsBooked {
get
;
set
; }
public
Deal(
string
id, DateTime receivedTime)
{
Id = id;
ReceivedTime = receivedTime;
}
}
My grid has 4 columns bound to each of the Deal properties, with bindings such as 'Deal.Id', 'Deal.ReceivedTime', etc.
All displays correctly, but when I call the UpdateBookingStatus method, which updates a couple of Deal properties and then fires a PropertyChanged event on the Deal itself, the Deal.BookingTime and Deal.IsBooked column values are not always refreshed in the grid. If I scroll the relevant rows out of view and then back into view, the values are updated correctly.
Is this expected? Am I not supposed to be setting nested bindings on Columns? Should the grid not listen for the
OnPropertyChanged(
"Deal"
)
event and update all columns using that property?Thanks.
Marcus.