I have an image in wpf application and bind its Source property to System.Windows.Controls.Image in view model but it is not working. But when i bind its Source property to a BitmapImage, it is working. Is there any way to bind Source property as System.Windows.Controls.Image ?
Xaml Part
<Image x:Name="ShipMainImage" Source="{Binding MainImageSource}" />
View model Part
public class StabilityVM : INotifyPropertyChanged {
private System.Windows.Controls.Image mainImageSource;
public System.Windows.Controls.Image MainImageSource
{
get { return mainImageSource; }
set {
mainImageSource = value;
OnPropertyChanged(nameof(MainImageSource)); }
}
protected virtual void OnPropertyChanged(string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
}