views:

628

answers:

2
+1  A: 

You should do this way,

((TextBlock)btnPrescan.GetTemplatedChild("tbButtonText")).Text = "Your Text"
Akash Kava
+2  A: 

Bind the text to a backing property on your UserControl:

<Button x:Name="btnPrescan" Margin="8" Grid.Column="2" Click="btnPrescan_Click">
    <StackPanel Orientation="Horizontal">
         <Image Source="Icons\Scan_Start_Icon.png" Height="14" Width="23"/>
         <!-- assumes DataContext is set appropriately -->
         <TextBlock Text="{Binding ButtonText}"/>
    </StackPanel>
</Button>

Then just change the backing property:

this.ButtonText = "New button text";

HTH, Kent

Kent Boogaart