TimePicker:Silverlight Toolkit错误:'无效的属性值控件:属性TargetType'的LongListSelector

时间:2011-11-19 03:34:04

标签: windows-phone-7

我正在尝试在新的WP7应用程序中实现TimePicker。 但是当我运行应用程序时...... 始终存在错误:

'无效的属性值控件:属性TargetType'的LongListSelector

这是我的xaml代码

<phone:PhoneApplicationPage 
    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:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    x:Class="WindowsPhoneApplication3.NewOrEditCoursePage"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    Orientation="Portrait"
    shell:SystemTray.IsVisible="True" >

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto" MinHeight="607"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <StackPanel HorizontalAlignment="Left" Height="450" Margin="8,8,0,0" VerticalAlignment="Top" Width="440">
                <StackPanel Orientation="Vertical">
                    <TextBlock TextWrapping="Wrap" Text="" Margin="0,0,0,5" Foreground="{StaticResource PhoneSubtleBrush}"/>
                    <TextBox TextWrapping="Wrap" Text="TextBox"/>
                </StackPanel>
                <controls:TimePicker Header="StartTime" Width="440" Height="100"/>
                <controls:TimePicker Header="EndTime" Width="440" Height="100" />
                <StackPanel Orientation="Vertical">
                    <TextBlock TextWrapping="Wrap" Text="Address" Foreground="{StaticResource PhoneSubtleBrush}" />
                    <TextBox TextWrapping="Wrap" Text="TextBox"/>
                </StackPanel>
            </StackPanel>
            <StackPanel HorizontalAlignment="Left" Height="100" VerticalAlignment="Bottom" Width="400" Margin="36,0,0,8" Orientation="Horizontal">
                <Button Content="Submit" HorizontalAlignment="Left" Width="200" Height="80"/>
                <Button Content="Cancel" Width="200" Height="80"/>
            </StackPanel>
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>

顺便说一下,我添加了“Microsoft.Phone.Controls.Toolkit.dll”

1 个答案:

答案 0 :(得分:0)

您发布了错误的XAML。我们需要用于控制的XAML。

无论如何,错误消息表示您试图在Value上设置LongListSelector属性。 <{1}}控件不公开这样的依赖属性,因此您无法设置它。