I’m trying to get the result of variable into a textblock.text proprety, I’m using
this code:
bool isavailable = NetworkInterface.GetIsNetworkAvailable();
result = isavailable.ToString();
<TextBlock Height="62" HorizontalAlignment="Left" Margin="12,60,0,0"
Name="textBlock1" Text="{Binding result}" VerticalAlignment="Top"
Width="400" Foreground="White" TextWrapping="Wrap" />`
Do you need to keep the binding? The simplest approach here would be to simply use:
However, the better approach would be to use a ViewModel implementing
INotifyPropertyChangedwith an appropriate property. Then you would make yourTextBlockbind to the property, and set the property from your code. The property would raise the appropriate event, and the UI would update accordingly.