How to add text to a WPF Label in code? How to add text to a WPF Label in code? wpf wpf

How to add text to a WPF Label in code?


Try DesrLabel.Content. Its the WPF way.


In normal winForms, value of Label object is changed by,

myLabel.Text= "Your desired string";

But in WPF Label control, you have to use .content property of Label controlfor example,

myLabel.Content= "Your desired string";


I believe you want to set the Content property. This has more information on what is available to a label.