Label with static text and binding
<p>I am trying to get a label to show specific text while also being bound to a variable in the VB.Net code. I can make a binding but I cant get it to add the static text.</p>

<p>What I have so far: </p>

<pre><code>&lt;Label x:Name="TestLabel" Content="{Binding Path=Row, StringFormat='Row #{0}'}" 
                          HorizontalAlignment="Left" 
                          Height="35" 
                          Margin="203,21,0,0" 
                          VerticalAlignment="Top" 
                          Width="83" 
                          FontSize="18"&gt;
</code></pre>

<p>with</p>

<pre class="lang-vb prettyprint-override"><code>Public Class Row
    Implements INotifyPropertyChanged

    Private _Row As Byte
    Public Property Row() As Byte
        Get
            Return _Row
        End Get
        Set(ByVal value As Byte)
            _Row = value

            OnPropertyChanged(New PropertyChangedEventArgs("Row"))
        End Set
    End Property

    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

    Public Sub OnPropertyChanged(ByVal e As PropertyChangedEventArgs)
        If Not PropertyChangedEvent Is Nothing Then
            RaiseEvent PropertyChanged(Me, e)
        End If
    End Sub
End Class
</code></pre>

<p>and</p>

<pre class="lang-vb prettyprint-override"><code>Private Rows As New Row

Public Sub New()
    InitializeComponent()
    TestLabel.DataContext = Rows
    Rows.Row = MyTextBox.Text.HandledStringtoSByte
End Sub
</code></pre>

<p>The extension code (since I have a custom extension):</p>

<pre class="lang-vb prettyprint-override"><code>''' &lt;summary&gt;
''' Handles conversion of string variable to Tiny Integer
''' &lt;/summary&gt;
''' &lt;param name="s"&gt;&lt;/param&gt;
''' &lt;param name="I"&gt;Returned if conversion fails.&lt;/param&gt;
''' &lt;returns&gt;Signed 8bit Integer&lt;/returns&gt;
''' &lt;remarks&gt;&lt;/remarks&gt;
&lt;Runtime.CompilerServices.Extension()&gt; _
Public Function HandledStringtoSByte(ByRef S As String, Optional I As SByte = 0) As SByte
    Try
        If S = String.Empty Then
            Return I
        Else
            Return SByte.Parse(S)
        End If
    Catch
        Dim result As String = String.Empty
        Dim ReturnByte As SByte
        Dim Parsed As Byte
        For Each Character In S.ToCharArray
            If Character = "-" Then
                If S.Substring(0, 1).ToString &lt;&gt; "-" Then
                    Exit For
                End If
            End If
            If Character = "." Then
                Exit For
            End If
            If Byte.TryParse(Character, Parsed) Then
                result = result + Parsed.ToString
            End If
        Next
        If result &lt;&gt; String.Empty Then
            If SByte.TryParse(result, ReturnByte) Then
                Return SByte.Parse(ReturnByte)
            Else
                If Short.Parse(result) &gt; Short.Parse(SByte.MaxValue.ToString) Then
                    Return SByte.MaxValue
                ElseIf Short.Parse(result) &lt; Short.Parse(SByte.MinValue.ToString) Then
                    Return SByte.MinValue
                Else
                    Return SByte.Parse(ReturnByte)
                End If
            End If
        Else
            Return I
        End If
    End Try
End Function
</code></pre>

<p>Now I thought that using the stringformat in binding would add the static text and place the bound variable into the {0} spot but all is gives me is the bound variable in the label.</p>

<p>What am i doing wrong?</p>