我想使用wp toolkit的TimePickerPage.xaml进行一些自定义

时间:2013-08-02 10:17:50

标签: c# xaml windows-phone-8 toolkit windows-phone-toolkit

我正在使用WP Toolkit中的 <toolkit:TimePicker/> 它的PickerPageUri设置为/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/TimePickerPage.xaml

我希望在此页面中进行一些自定义,例如它的背景应为白色,正文块应 PICK TIME 应用栏背景应为灰色
和图标应为黑色

enter image description here

我已下载TimePickerPage.xamlTimePickerPage.xaml.cs,以便我可以快速更改其属性并将其源设置为我的新CustomTimePickerPage.xaml,其实际上包含TimePickerPage.xaml的99%代码。

但它给了我下面的错误 enter image description here

有谁能告诉我如何解决这个问题?

以下是TimePickerPage.xaml

1 个答案:

答案 0 :(得分:1)

问题是声明xmlns,下面是声明primitivescontrols xmlns

的正确方法
<primitives:DateTimePickerPageBase
    x:Class="FamilyMap.CustomUIElements.CustomTimePicker"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:primitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="728" d:DesignWidth="480">