I'm sure this is a ridiculously easy solution but I can't seem to figure it out. I'm new to WP7 programming and Expression Blend modifications in general.
I've created a custom button(template) in Expression Blend that I use in several places in a Windows Phone 7 app. I've deleted the content of the custom button but I can no longer modify the content of the button afterwards.
For instance, if I have several buttons of the same type(based on the template) on the same page I cannot figure out how to modify the content later on.
Here is how the button is handled in the App.xaml:
<Application.Resources>
<ControlTemplate x:Key="Main1StopButtons" TargetType="Button">
<Border BorderThickness="3" CornerRadius="25">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF181616" Offset="0.01"/>
<GradientStop Color="#FF494444" Offset="0.684"/>
</LinearGradientBrush>
</Border.BorderBrush>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF0A0909" Offset="0.797"/>
<GradientStop Color="#FF272727" Offset="0.003"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock TextWrapping="Wrap" Text=""/>
</Border>
</ControlTemplate>
</Application.Resources>
If I modify the "Text" of the TextBlock (to 'Button') then all buttons using the template have the Text of 'Button'.
Thank you for your patience :)
Use TemplateBinding
for this. It says to get a property from a control and put it here to a template:
<TextBlock TextWrapping="Wrap" Text="{TemplateBinding Content}"/>
Or for something more complex:
<ContentControl Content="{TemplateBinding Content}" />