Handle event when Label Text Change

前端 未结 2 1013
执笔经年
执笔经年 2021-01-28 17:24

I\'m developing App which communicate with RFID Reader, I have the following Label which takes it\'s value from the Reader (when I click on the read button on the hardware)

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-28 17:52

    As was mentioned in the comments, it looks like the Statistics class must implement INotifyPropertyChanged (that's how the binding is able to update the UI when the data changes). If that's the case, you should just subscribe to that same event in your code. Wherever you have access to that Statistics variable (in code bebhind or viewmodel), just do

    Statistics.PropertyChanged += (o,e)=> 
    { 
        if (e.PropertyName = "TotalUniqueCount")
        {
          //do something
        }
    }
    

提交回复
热议问题