Hello,
When we update an UI control by code, that control generates a event.
For example, if we make a CheckBox Checked, then the CheckedChanged event is fired.
That is a goog behavior, but not at the first time (initialization).
Here the scenario :
<code>
SomeObject data ;
....
void UpdateData2UI()
{
this.checkbox.checked = data.IsPlaying ;
}
void checkbox_CheckedChanged(...)
{
data.IsPlaying = this.checkbox.checked ;
}
</code>
At UI initialization data.IsPlaying is "read" then "write" without necessity.
It could be a bad stuff if data.IsPlaying has to do some stuff.
Is the only solution is to add a test in checkbox_CheckedChanged ??
Like :
<code>
void checkbox_CheckedChanged(...)
{
if( this.checkbox.checked != data.IsPlaying )
{
data.IsPlaying = this.checkbox.checked ;
}
}
</code>
How do you do for that situation ?
I hope my explanation are clear enough ...
cyrille