2013-03-12 93 views
1

我开发了一个使用MVVM(Prism v4.1)的Windows Phone应用程序。 当我将它部署到Emulator WVGA或我的HTC 8X时,一切正常,但是当我将其部署到我的Lumia 800或使用Emulator 7.1时,它无法正常工作。棱镜不能在WP7.1中工作,但在WP8中工作

这里是视图(模型)希望它有助于有点

View

<phone:PhoneApplicationPage 
    x:Class="LearnByTranslate.Views.PhrasePracticeView" 
    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:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
    xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" 
    xmlns:converter="clr-namespace:LearnByTranslate.Infrastructure.Convverters" 

    FontFamily="{StaticResource PhoneFontFamilyNormal}" 
    FontSize="{StaticResource PhoneFontSizeNormal}" 
    Foreground="{StaticResource PhoneForegroundBrush}" 
    SupportedOrientations="Portrait" Orientation="Portrait" 
    mc:Ignorable="d" 
    shell:SystemTray.IsVisible="True"> 

    <Grid x:Name="LayoutRoot" Background="Transparent"> 
     <ScrollViewer Margin="24,0,24,72" Grid.Row="1"> 
      <StackPanel x:Name="stkPracticeContent" Margin="0"> 
       <TextBlock x:Name="txtTextToTranslate" HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding EnglishPhrase,Mode=TwoWay}" FontSize="40" FontStyle="Normal" VerticalAlignment="Top" Style="{StaticResource EnglishSentenceStyle}" FontFamily="Segoe WP Light"> 
        <TextBlock.Foreground> 
         <SolidColorBrush Color="{StaticResource PhoneForegroundColor}"/> 
        </TextBlock.Foreground> 
       </TextBlock>    
      </StackPanel> 
     </ScrollViewer> 
    </Grid> 
</phone:PhoneApplicationPage> 

ViewModel

class PhrasePracticeViewModel : NotificationObject 
{  
    private string _englishPhrase;  

    public PhrasePracticeViewModel() 
    { 

    }  

    public string EnglishPhrase 
    { 
     get { return _englishPhrase; } 
     set 
     { 
      _englishPhrase = value; 
      RaisePropertyChanged(() => EnglishPhrase); 
     } 
    }  
} 

一切工作正常(关于其他的绑定的一部分意见)除了这个观点。

任何想法?

+0

一旦显示视图,究竟是什么错误。你能提供更多细节吗?你有Convverters拼写错误,但它没有使用,你可以删除该命名空间。也许样式不适当地包括。 – 2013-03-13 07:06:44

+0

问题是标签根本没有显示,但我知道EnglishPhrase属性已填充(即使应该显示该单词的空间缺失)。我伤心。它在WP8仿真器上工作,但不在WP7.1上 我在这个视图上也有一些按钮和其他东西,但绑定的非绑定在WP7.1中工作 – 2013-03-13 07:55:23

回答

1

这是我见过的最奇怪的事情之一。

这是reasone是我的ViewModel类没有制作public(如你所见)。我会更深入地探讨一下为什么这个WP8可以工作,但不是WP7.1,但它让我很失望。

希望这可以帮助别人。

+0

很好,你设法最终修复它。我在绑定和忘记将属性公开时遇到了问题......但为什么它会在一个模拟器上运行,而另一个模拟器却不会让我困惑。 – 2013-03-13 09:07:20

+0

不仅在手机上也放在设备上(Lumia 800和HTC 8X)。我会发一封电子邮件,看看我能否从中得到一些东西。 – 2013-03-13 09:54:44

相关问题