I'd like to create a template for my button for which I can change the values from code.
This is my template :
<Button Name="button">
<Button.Template>
<ControlTemplate>
<Border Name="bordure_bouton" >
<Grid Name="GridPrincipale">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Image Name="icone" Margin="5" Source="icon.png" RenderOptions.BitmapScalingMode="Fant" Stretch="None" Grid.Column="1"/>
<TextBlock Height="40" Name="label_text" FontSize="12" Text="texte" TextAlignment="Left" VerticalAlignment="Center" Grid.Column="0" Padding="12" Tag="2"/>
</Grid>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
And I'd like to be able to change the text and the image from my code doing something like that :
this.icon.Source = "icon2.png";
this.label_text.Text = "text";
How can I do that?