Determine If Changed Event Occurred from User Input Or Not

后端 未结 6 821
借酒劲吻你
借酒劲吻你 2021-01-18 00:38

In C#, the Changed event for a control (say, a numericupdown) gets fired whether the value was change directly by the user or if it was changed programatically as the result

6条回答
  •  南笙
    南笙 (楼主)
    2021-01-18 01:22

    One interesting case is the ComboBox control, which does differentiate between changes in the selection by the SelectionChangeCommitted event, which is raised only when the user makes a change via the GUI, and the SelectedIndexChanged event, which is raised every time the SelectedIndex property changes. You could examine the source for the ComboBox and see how it's done. Of course, there's no guarantee that the principle will be transferable to other controls.

提交回复
热议问题