솔루션은 데이터 개체 자체의 정의를 수정할지 여부에 따라 달라질 수 있습니다. 데이터 객체를 수정할 수 있으면 업데이트 허용 여부를 제어하는 플래그를 추가 할 수 있습니다. 그런 다음 hover 이벤트에 대한 응답으로이 속성을 설정할 수 있습니다. 또한, 모든 속성 변경 이벤트는 대기열에 올려지고 업데이트가 다시 켜지면 실행됩니다 (원하는 동작이라고 가정).
개체를 수정할 수없는 경우 대신 개체를 수정하여이 개체를 지원할 수 있습니다. 여기
이벤트를 지연하는 방법의 예입니다
class DataObject
{
private bool _canUpdate = true;
List<string> propertiesChangedDelayed = new List<string>();
public bool CanUpdate
{
get { return _canUpdate; }
set
{
if (value != _canUpdate) {
_canUpdate = value;
if (_canUpdate)
NotifyPropertyChangedDelayed();
}
}
}
protected void NotifyPropertyChanged(string property)
{
if (CanUpdate) {
// fire event
} else {
propertiesChangedDelayed.Add(property);
}
}
private void NotifyPropertyChangedDelayed()
{
foreach (string property in propertiesChangedDelayed)
{
NotifyPropertyChanged(property);
}
propertiesChangedDelayed.Clear();
}
}
감사합니다 - 나는 대화로 UI를 필요로하기 때문에 나는이 작동합니다 생각하지 않습니다. –