我正在尝试遵循教程here,称为在Windows Phone应用中检索,存储和显示数据
首先,我必须在Blend中创建设计时数据。 项目具有绿色或红色边框,具体取决于数据值。我复制粘贴转换一定数量的颜色所需的代码。
在xaml中我需要复制这一行:
<local:SeverityColorConverter x:Key="SeverityColorConverter" DefaultAndLowPriorityColor="Green" HighPriorityColor="Red"/>
但是,本地关键字让我感到困惑。
长话短说:我复制了提供的全部xaml代码,以了解它应该如何解决, 我得到了各种命名空间错误:例如
The URI "clr-namespace:Microsoft.Phone.Shell; assembly=Microsoft.Phone" is not a valid namespace identifier.
由于我是Windows手机编程的新手,我完全糊涂了。请原谅我在这个问题上寻求帮助的混乱方式,因为我完全混淆了。
任何帮助将不胜感激!我在下面提供了XAML代码,可以通过上面的链接找到教程本身。
Here's the complete XAML mark up for this page:
<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:toolkit="clr-namespace:Microsoft.Phone.Controls;
assembly=Microsoft.Phone.Controls.Toolkit"
x:Class="Defects.AddDefectPage"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="DefectTypesItemTemplate">
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar>
<shell:ApplicationBarIconButton
IconUri="/Assets/AppBar/feature.camera.png"
Text="photo" />
<shell:ApplicationBarIconButton
IconUri="/Assets/AppBar/save.png"
Text="save" />
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
<Grid x:Name="LayoutRoot"
Background="Transparent"
d:DataContext=
"{Binding Source={StaticResource AddDefectDataSource}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"
Margin="12,17,0,28">
<TextBlock Style="{StaticResource PhoneTextNormalStyle}"
Text="DEFECTS" />
<TextBlock Text="new defect"
Margin="9,-7,0,0"
Style="{StaticResource PhoneTextTitle1Style}" />
</StackPanel>
<StackPanel x:Name="ContentPanel"
Grid.Row="1"
Margin="12,-12,12,0">
<Grid Margin="{StaticResource PhoneMargin}"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Width="200"
Height="200">
<Border BorderBrush="Black"
BorderThickness="1"
Background=
"{StaticResource PhoneContrastBackgroundBrush}"
Opacity="0.1" />
<Image Source="{Binding NewDefect.Photo}" />
</Grid>
<TextBlock Text="Title"
Style="{StaticResource PhoneTextSubtleStyle}" />
<TextBox Height="72"
TextWrapping="Wrap"
Text="{Binding NewDefect.Title, Mode=TwoWay}" />
<toolkit:ListPicker Header="Defect Type"
ItemTemplate="{StaticResource DefectTypesItemTemplate}"
ItemsSource="{Binding DefectTypes}"
FullModeItemTemplate=
"{StaticResource DefectTypesItemTemplate}" />
</StackPanel>
</Grid>
</phone:PhoneApplicationPage>
答案 0 :(得分:2)
正确解析命名空间可能是个问题。 This thread可以帮到你。
预测您的示例,而不是像这样引用命名空间
clr-namespace:Microsoft.Phone.Shell; assembly=Microsoft.Phone
您应该在程序集
之前删除前导空格clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone