2011-09-14 19 views
5

Mam następujący problem z TimePicker \ DatePicker z Silverlight Toolkit dla WP7. Nie wiem, jak zmienić rozmiar czcionki w TextBox wewnątrz próbnika:Zestaw narzędzi Silverlight dla WP7, DatePicker TimePicker problem z fontsize

własności

FontSize:

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

zmiany tylko Header rozmiar czcionki

Chociaż FontFamily lub Fo ntWeight dotyczy zarówno nagłówka, jak i TextBox. Jak zmienić FontSize w TextBox?

Here is the same question o silverlight forum

Odpowiedz

8

To dlatego, że w swoich domyślnych stylów, rozmiar czcionki nie jest ustawiona poprzez TemplateBinding. Zobacz część: * *, która powinna wystarczyć. :)

<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> 
+1

To jest to! Dzięki :) – szysz3kster

+1

Aby wykluczyć właściwość PickerPageUri, działa zgodnie z oczekiwaniami w zestawie Windows Phone 8 SDK + zestaw narzędzi Windows Phone 4.2013, aby ustawić rozmiar czcionki. Jest jeszcze jeden przykład w https://windowsphone.svn.wordpress.org/trunk/WordPress/App.xaml, który ma również ustawnik szablonów dla TimePicker. – noxo

0

oparciu o wordpress link z noxo to działa dobrze dla mnie:

<Style x:Key="DatePickerStyle1" TargetType="toolkit:DatePicker" BasedOn="{StaticResource DateTimePickerStyles}"> 
     <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="Auto" FontSize="{TemplateBinding FontSize}"/> 
        </StackPanel> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style>