The grid does not seem to be subscribing to PropertyChanged on INotifyPropertyChanged. All the bound data objects provide INotifyPropertyChanged, but when they go to fire this event the event handler is null; meaning no one is listening. The grid keeps showing the old data until I select the row.
Here is code to reproduce it:
public
partial
class
RadForm1 : RadForm
{
private
Timer _timer;
private
ObservableCollection<GridData> _data;
public
static
bool
GridBound =
false
;
public
RadForm1()
{
InitializeComponent();
}
protected
override
void
OnLoad( EventArgs e )
{
base
.OnLoad( e );
var gv =
new
RadGridView();
gv.Dock = DockStyle.Fill;
Controls.Add( gv );
_data =
new
ObservableCollection<GridData>()
{
new
GridData { First =
"A"
, Second =
"B"
, Third =
"C"
},
new
GridData { First =
"AA"
, Second =
"BB"
, Third =
"CC"
},
new
GridData { First =
"AAA"
, Second =
"BBB"
, Third =
"CCC"
}
};
gv.DataSource = _data;
GridBound =
true
;
_timer =
new
Timer();
_timer.Tick += _timer_Tick;
_timer.Interval = 1000;
_timer.Start();
}
private
void
_timer_Tick(
object
sender, EventArgs e )
{
_data[0].First =
"D"
;
_data[1].Second =
"EE"
;
_data[2].Third =
"FFF"
;
_timer.Stop();
}
private
class
GridData : INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler PropertyChanged;
private
void
OnPropertyChanged(
string
name )
{
if
( PropertyChanged ==
null
&& RadForm1.GridBound )
{
Debug.WriteLine( $
"PropertyChanged is null, grid has not subscribed! Name = '{name}'"
);
}
PropertyChanged?.Invoke(
this
,
new
PropertyChangedEventArgs( name ) );
}
private
string
_first;
private
string
_second;
private
string
_third;
public
string
First {
get
=> _first;
set
{ _first = value; OnPropertyChanged(
"First"
); } }
public
string
Second {
get
=> _second;
set
{ _second = value; OnPropertyChanged(
"Second"
); } }
public
string
Third {
get
=> _third;
set
{ _third = value; OnPropertyChanged(
"Third"
); } }
}
}