1

MVVM (Prism v4.1) を使用して Windows Phone アプリケーションを開発しました。Emulator WVGAまたは HTC 8Xに展開するとすべて正常に動作しますが、Lumia 800 に展開するか、または を使用するEmulator 7.1と動作しません。

これはビュー(モデル)の一部です。少し役立つことを願っています

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);
        }
    }       
}

このビューを除いて、すべてが正常に機能しています (他のビューのバインディングに関して)。

何か案は?

4

1 に答える 1

1

これは私が今まで見た中で最も奇妙なものの 1 つです。

この理由は、ViewModel クラスが作成されなかったpublicためです (上記を参照)。これがWP8では機能するのにWP7.1では機能しない理由をもう少し詳しく調べますが、本当にイライラしました。

これが他の誰かに役立つことを願っています。

于 2013-03-13T08:44:09.517 に答える