I want to get text from below TextBlock but i can't get it ?? Note : fname is property for setting text in TextBlock
<TextBlock Name="getname" Text="{Binding Path=fname }"/>
By default, the text binding for a TextBlock is One-Way. You'll need to explicitly specify a Two-Way binding if you want to read the value back into your view model.
Text="{Binding Path=fname, Mode=TwoWay}"
If you're not using view models and you just want programmatic access to the text value you'll need to access the value in code-behind.
public string GetTextBlockText()
{
return this.getname.Text;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.