0
我有一個應該做幻燈片放映的圖像控件。 下面是我用來實現這一目標的結合:WPF中的圖像綁定
Binding mapBinding = new Binding();
mapBinding.Source = slideView;
mapBinding.Path = new PropertyPath("ImageDrawing");
sliderImage.SetBinding(System.Windows.Controls.Image.SourceProperty, mapBinding);
和A類SlideImage
public class SlideImage : INotifyPropertyChanged {
public ImageSource ImageDrawing{get;set;}
public void ChangeImage(){
// Load another image
// Update ImageDrawing
// Fire property changed event
}
public event PropertyChangedEventHandler PropertyChanged;
}
我發現在網上很多例子使用UpdateSourceTrigger
監聽數據源的變化。唯一的問題是Image
控件沒有該屬性。
如何連接我的sliderImage
控件以更新SlideImage.PropertyChanged
?
剛剛檢查過我的代碼,實際上是從模型中引發事件,但視圖消耗了它,並沒有將其轉發到GUI。非常感謝指針,我很欣賞+1 – GETah