Reputation: 3456
I am new in windows phone 7. I am doing a sample for making a rounded corner button in silverlight for windows phone 7. I achieved the rounded corners. But it is not showing the content of the button. Whats wrong in my code ?. Please help me.
now my button looks like this. No text in it.
I posted my code below.
Thanks.
MainPage.xaml
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<StackPanel VerticalAlignment="Center">
<Button Width="200" Height="80" Content="Click Me" Style="{StaticResource myCustomButtonStyle}" >
</Button>
</StackPanel>
</Grid>
ButtonResourceDictionary.xaml
<LinearGradientBrush x:Key="myCustomButtonColor" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF296180" Offset="0.589"/>
<GradientStop Color="#FF5BC0F3"/>
</LinearGradientBrush>
<Style x:Name="myCustomButtonStyle" TargetType="Button">
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{StaticResource myCustomButtonColor}" CornerRadius="12"></Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Upvotes: 0
Views: 332
Reputation: 14950
You need to add a 'ContentPresenter' element into your template to display the content
Upvotes: 1