在窗口电话7中更改Listpicker的项目的字体大小

时间:2013-04-01 09:56:37

标签: windows-phone-7

我有两个ListPicker。我绑定了lpkfamilymemberfrom数据库和lpkpaymentmode从数组值。我想两个作为全屏模式和全屏我想要项目字体大小40。 lpkfamilymemberfrom我实现了字体大小40,因为我已经完成了以下代码。但我不知道如何为lpkpaymentmode becoze实现它没有任何datatemplate becoz我使用Array绑定它。

 <DataTemplate x:Name="PickerFullModeItemTemplate">
            <StackPanel Orientation="Horizontal" Margin="16 21 0 20">
                <TextBlock Text="{Binding Name}" Margin="16 0 0 0" FontSize="43" FontFamily="{StaticResource PhoneFontFamilyLight}"/>
            </StackPanel>
        </DataTemplate>

   <toolkit:ListPicker Background="White" FontSize="44" ExpansionMode="FullScreenOnly"     x:Name="lpkpaymentmode"/>
  <toolkit:ListPicker ItemTemplate="{StaticResource PickerItemTemplate}" Background="White"  FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" ExpansionMode="FullScreenOnly"       x:Name="lpkfamilymember"/>

和绑定代码:

 String[] Mode = { "Cash", "Credit Card", "Debit Card","Net Banking" };

        InitCustomPickerDialog();

        this.lpkpaymentmode.ItemsSource = Mode;

        this.lpkfamilymember.ItemsSource = GetfamilyList();

     public IList<FamilyVO> GetfamilyList()
    {
        // Fetching data from local database
        IList<FamilyVO> FamilyList = null;
        using (ExpenseDataContext Empdb = new ExpenseDataContext(strConnectionString))
        {
            IQueryable<FamilyVO> ExpQuery = from Exp in Empdb.Family select Exp;
            FamilyList = ExpQuery.ToList();

        }

        return FamilyList;
    }

我已经尝试了很多代码,在完整模式下将lpkpaymentmode的项目大小设置为40,但每次显示一些没有更改的修复大小。

1 个答案:

答案 0 :(得分:2)

这个怎么样:

<DataTemplate x:Name="ItemTemplateForPayment">
    <TextBlock Text="{Binding }" Margin="16 0 0 0" FontSize="40" FontFamily="{StaticResource PhoneFontFamilyLight}"/>
</DataTemplate>

然后像这样申请:

<toolkit:ListPicker ItemTemplate="{StaticResource PickerItemTemplate}" Background="White"  FullModeItemTemplate="{StaticResource ItemTemplateForPayment}" ExpansionMode="FullScreenOnly" x:Name="lpkpaymentmode"/>