Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight toolkit for WP7, DatePicker\TimePicker fontsize pro­blem

I have following problem with TimePicker \ DatePicker from Silverlight Toolkit for WP7. I don't know how to change the font size in TextBox inside picker:

FontSize property:

<toolkit:DatePicker FontSize="30" Foreground="Black"  Header="tas" Name="dpiker"/>

changes only Header font size

Although FontFamily or FontWeight applies to both Header and TextBox. How to change FontSize in TextBox?

Here is the same question o silverlight forum

like image 404
szysz3kster Avatar asked Sep 14 '11 12:09

szysz3kster


1 Answers

This is because in their default styles, the font size is not set via TemplateBinding. See the ** part, that should do the trick. :)

    <Style TargetType="toolkit:DatePicker">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="PickerPageUri" Value="/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/DatePickerPage.xaml"/>
        <Setter Property="ValueStringFormat" Value="{}{0:d}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:DatePicker">
                    <StackPanel>
                        <ContentControl ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="{StaticResource PhoneSubtleBrush}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="12,0,12,-4"/>
                        <Button x:Name="DateTimeButton" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Content="{TemplateBinding ValueString}" Foreground="{TemplateBinding Foreground}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Height="72" **FontSize="{TemplateBinding FontSize}"**/>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
like image 102
Justin XL Avatar answered Nov 12 '22 17:11

Justin XL