2011-09-14 17 views
5

मुझे WP7 के लिए सिल्वरलाइट टूलकिट से टाइमपीकर \ डेटपिकर के साथ निम्नलिखित समस्या है। मैं नहीं जानता कि चयनकर्ता के अंदर पाठ बॉक्स में फ़ॉन्ट आकार बदलने के लिए कैसे:WP7 के लिए सिल्वरलाइट टूलकिट, डेटपिकर टाइमपिकर फोंटनाइज समस्या

FONTSIZE संपत्ति:

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

परिवर्तन केवल हैडर फ़ॉन्ट आकार

हालांकि FontFamily या Fo ntWeight हेडर और टेक्स्टबॉक्स दोनों पर लागू होता है। टेक्स्टबॉक्स में फ़ॉन्ट आकार कैसे बदलें?

Here is the same question o silverlight forum

उत्तर

8

इसका कारण यह है उनके डिफ़ॉल्ट शैलियों में, फ़ॉन्ट आकार TemplateBinding के माध्यम से सेट नहीं है है। * * भाग देखें, जो चाल चलाना चाहिए। :)

<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

यह बात है! धन्यवाद :) – szysz3kster

+1

PickerPageUri प्रॉपर्टी को बाहर करना था, फिर यह फ़ॉन्ट आकार सेट करने के लिए विंडोज फोन 8 एसडीके + विंडोज फोन टूलकिट 4.2013 पर अपेक्षित काम करता है। Https://windowsphone.svn.wordpress.org/trunk/WordPress/App.xaml में एक और नमूना है जिसमें टाइमपिकर के लिए टेम्पलेट सेटटर भी है। – noxo

0

noxo से वर्डप्रेस लिंक के आधार पर यह मेरे लिए अच्छी तरह से काम:

<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> 
संबंधित मुद्दे