2011-11-19 55 views
0

我试图在新的WP7应用程序中实现TimePicker .. 但是当我运行应用程序时... 总是有一个错误:TimePicker:Silverlight工具包错误:'属性值控件无效:属性TargetType的LongListSelector'

'无效的属性值控制:LongListSelector财产的TargetType'

这是我的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”

回答

0

您发布了错误的XAML。我们需要控件的XAML。

无论如何,错误消息意味着您试图在LongListSelector上设置Value属性。 LongListSelector控件不公开这样的依赖项属性,因此您无法设置它。

相关问题