私は、Imageプロパティを持つクラスを持っている:エラー結合画像のtypeプロパティ
...
<ContentControl Margin="5,0,20,0"
Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Center"
Content="{Binding CoverImage}"/>
...
画像:私はポップアップでユーザーコントロール(命名FullDescription)に特異的に結合する
...
public Image m_coverImage;
public Image CoverImage
{
get { return m_coverImage; }
set
{
m_coverImage = value;
//OnPropertyChanged(new PropertyChangedEventArgs("CoverImage"));
}
}
...
以前にロードされていて、親コントロール(上記と同じ方法でバインドされています)で正しく表示されていますが、FullDescription UserControlにバインドしようとすると...
...
FullDescription descriptionPopup = new FullDescription();
descriptionPopup.DataContext = this.Ebook; //This line throw error
...
... ArgumentExceptionエラーが発生します。
System.ArgumentExceptionが処理されませんでした メッセージ=パラメータが間違っています。 のStackTrace:MS.Internal.XcpImports.CheckHResultで (UInt32型のHR) MS.Internal.XcpImports.SetValueで(INativeCoreTypeWrapper OBJ、たDependencyPropertyプロパティ、のDependencyObjectのDOH) MS.Internal.XcpImports.SetValue(DOH INativeCoreTypeWrapper、たDependencyProperty施設でSystem.Windows.Data.BindingExpression.RefreshExpressionでSystem.Windows.DependencyObject.RefreshExpression(たDependencyProperty DP) (AT System.Windows.DependencyObject.SetObjectValueToCore(DPたDependencyProperty、Object値で、オブジェクトobj) ) )システムで 。 Windows.Data.BindingExpression.SendDataToTarget() (System.Windows.Data.BindingExpression.SourceAquired()) (System.Windows.Data.BindingExpression.Dat) System.Windows.FrameworkElement.OnAncestorDataContextChangedでSystem.Windows.FrameworkElement.OnDataContextChanged(DataContextChangedEventArgs電子) でaContextChanged(オブジェクトO、DataContextChangedEventArgs E) (DataContextChangedEventArgs E)System.Windows.FrameworkElement.NotifyDataContextChangedで (DataContextChangedEventArgs E) システムでSystem.Windows.FrameworkElement.NotifyDataContextChangedで.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs電子) (DataContextChangedEventArgs E)System.Windows.FrameworkElement.OnAncestorDataContextChangedで (DataContextChangedEventArgs E)System.Windows.FrameworkElement.NotifyDataContextChangedで (DataContextChangedEventArgs E) System.Windows.FrameworkElementでSystem.Windows.FrameworkElement.NotifyDataContextChangedで.OnAncestorDataContextChanged(DataContextChangedEventArgs電子) (DataContextChangedEventArgs E)System.Windows.FrameworkElement.OnAncestorDataContextChangedで (DataContextChangedEventArgs E)System.Windows.Controls.Primitives.Popup.NotifyDataContextChangedで (DataContextChangedEventArgs E) System.Windows.DependencyObject.RaisePropertyChangeNotificationsでSystem.Windows.FrameworkElement.OnPropertyChanged(たDependencyProperty DP) でSystem.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs E) (DPたDependencyPropertyでSystem.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs電子)で 、Object newValue、Object oldValue) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp、Object value)の にあるSystem.Windows.DependencyObject.SetValueInternal(DependencyProperty dp、Object value) (System.Windows.DependencyObject.SetValueInternal)で定義されています。 SetValue(DependencyProperty dp、Object value) at System.Windows.FrameworkElement.set_DataContext(Object value) at Mobiltec.Atheneum.Reader.WindowsPhone.Controls.EbookPhotoSummary。System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUpでSystem.Windows.Controls.HyperlinkButton.OnClickでhplMore_Click System.Windows.Controls.Primitives.ButtonBase.OnClickで(オブジェクト送信者、RoutedEventArgs e)の () () ( MouseButtonEventArgs E)MS.Internal.JoltHelper.FireEventでSystem.Windows.Controls.Control.OnMouseLeftButtonUp(コントロールCTRL、のEventArgs電子) (のIntPtr unmanagedObj、のIntPtr unmanagedObjArgs、のInt32 argsTypeIndex、文字列eventNameの) でMicrosoft.Xna.FrameworkでMicrosoft.Xna.Framework.Input.SafeNativeMethods.CallWindowProc(のIntPtr lpPrevWndFunc、のIntPtr hWndは、UInt32型MSG、のIntPtr wParamに、のIntPtrのlParamで.Input.UnsafeNativeMethods.CallWindowProc(のIntPtr lpPrevWndFunc、のIntPtr hWndは、UInt32型MSG、のIntPtr wParamに、のIntPtr lParamに) ) at Microsoft.Xna.Framework.Input.WindowMessageHooker.Hook.WndProc(IntPtr msgWnd、UInt32 msg、IntPtr wParam、IntPtr lParam)
アイデアはありますか?
ありがとうございます。
私は問題を解決することができました。
<Image Margin="5,0,20,0" Grid.Column="0" VerticalAlignment="Top"
HorizontalAlignment="Center" Source="{Binding CoverImage.Source}"/>
ため
<ContentControl Margin="5,0,20,0"
Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Center"
Content="{Binding CoverImage}"/>
を変更し、すべてが正常に動作します。ありがとう