Reputation: 11
I have the following TextBlock
:
<TextBlock VerticalAlignment="Vertical" Text="Name" />
This is the TextBlock
for my button on which I want to display name and value.
I want to display text on the button as Name[some_value].
I'm getting this this some_value
run-time from some function. How can I print the value here?
Upvotes: 0
Views: 1051
Reputation: 1771
Go to ViewModel
of that View
:
private string _buttonValue;
public string ButtonValue{
get {return _buttonValue;}
}
Go to constructor
and write down:
_buttonValue = "Name " + put_here_SomeValue_Runtime_Value;
Now, to to .xaml
Bind like belw:
<TextBlock Text="{Binding ButtonValue, Mode=OneWay}"/>
Upvotes: 0
Reputation: 608
It seems like you're not yet familiar with Binding
in XAML.
You can read, and see examples on MSDN here.
Upvotes: 1