What I am trying to do is use C# to write the code of ContentTemplate instead of XAML. Here is the XAML code that I have:
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="AnyButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="310"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="/Images/AnyImage.png" Height="80" Width="80" HorizontalAlignment="Left" Margin="15,0,0,0"/>
<TextBlock Grid.Column="1" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" Text="AnyText" FontSize="30" FontFamily="{StaticResource PhoneFontFamilySemiLight}" Margin="0,0,0,0"/>
</Grid>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
And here is the code that I used inside my ContentPanel to use the ContentTemplate:
<Button x:Name="MyButton"
Click="MyButton_Click"
ContentTemplate="{StaticResource AnyButton}"
Width="492" Height="130"
Margin="6,0,6,-6"
Background="#003d0a"/>
Now, my question is, is it possible to write the whole code using C#?