2016-07-15 12 views
1

こんにちは私はView この私のビューページにImageをリフレッシュする必要があります。INotifyPropertyChangedのdoesntの仕事(UWP

<Image Grid.Row="1" 
Grid.Column="1" 
x:Name="OriginalImg" 
Source="{Binding Orig}" 
DataContext="{StaticResource MainViewModel}"/> 

イム使用してMVVMLibsパッケージとこれは私のViewModelです:上の

public class MainViewModel: ViewModelBase 
{ 

    private WriteableBitmap original = new WriteableBitmap(1280,720); 
    private WriteableBitmap temp = new WriteableBitmap(1280,720); 

    public WriteableBitmap Orig 
    { 
     get { return original; } 
     set 
     { 
      this.original = value; 
      base.RaisePropertyChanged("Orig"); 
     } 
    } 
    public async Task<bool> ApplyEffectAsync(StorageFile file) 
    { 
     fileStream = await file.OpenAsync(FileAccessMode.Read); 
     temp.SetSource(fileStream); 
     Orig = temp; 
    } 
} 

しかしImage私ページが表示されない問題は何ですか?

+0

「ApplyEffectAsync」はどこにありますか? – niksofteng

+0

これは 'ICommand'を持つ別のクラスで呼び出され、このメソッドは正しく動作します。そして次のVSは私のセッターに行き、 'RaisePropertyChanged'を呼び出しますが、表示 – SmiLe

+0

に何も表示されません。私は 'Source =" {Binding Orig} "を使用しています。 – SmiLe

答えて

0

問題新しいWriteableBitmapを実際にインスタンス化していないのですが、そのソースを変更するだけです。だから、初めて動作するかもしれませんが、Dependency Property Managerは、インスタンスが変更されない限り、イメージが変更されたことを知らないため、動作しません。

Temporary WriteableBitmapをApplyEffectAsyncメソッドで作成してみてください。

関連する問題