Change Background Color for WPF textbox in changed-state

前端 未结 6 1653
故里飘歌
故里飘歌 2020-12-15 01:19

I have a class EmployeeViewModel with 2 properties \"FirstName\" and \"LastName\". The class also has a dictionary with the changes of the properties. (The class implements

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 01:37

    You could add to your ViewModel boolean properties like IsFirstNameModified and IsLastNameModified, and use a trigger to change the background if the textbox according to these properties. Or you could bind the Background to these properties, with a converter that returns a Brush from a bool...

提交回复
热议问题