WPF How to know the current button pressed among multiple buttons

前端 未结 4 1860
北荒
北荒 2020-12-15 13:24

I am having multiple buttons with contents 1, 2, 3, 4, 5... like this. All buttons are using same function on Click event.

4条回答
  •  暖寄归人
    2020-12-15 13:48

    You can get the content property using this in your function -

    string content = (sender as Button).Content.ToString();
    

提交回复
热议问题