2011-08-11 1 views
1

나는 이미지 속성을 가진 클래스가 :오류 바인딩 이미지 type 속성

... 
<ContentControl Margin="5,0,20,0" 
    Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Center" 
    Content="{Binding CoverImage}"/> 
... 

이미지 : 나는 팝업이있는 UserControl을 (이름 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 처리되지 않았습니다. 메시지 = 매개 변수가 올바르지 않습니다. 스택 트레이스 : MS.Internal.XcpImports.SetValue에서 MS.Internal.XcpImports.SetValue (INativeCoreTypeWrapper의 OBJ, DependencyProperty에 속성 DependencyObject에의 DOH) 에서 MS.Internal.XcpImports.CheckHResult (UINT32의 시간)에서 (DOH INativeCoreTypeWrapper, DependencyProperty에 등록 개체의 OBJ) System.Windows.Data.BindingExpression.RefreshExpression에서 System.Windows.DependencyObject.RefreshExpression에서 System.Windows.DependencyObject.SetObjectValueToCore (DependencyProperty에 DP, 개체 값) (DependencyProperty에 DP) () 시스템에서 에서 . Windows.Data.BindingExpression.SendDataToTarget() at System.Windows.Data.BindingExpression.SourceAquired() at System.Windows.Data.BindingExpression.Dat System.Windows.FrameworkElement.OnAncestorDataContextChanged에서 System.Windows.FrameworkElement.OnDataContextChanged (DataContextChangedEventArgs 전자) 에서 aContextChanged (개체 오, DataContextChangedEventArgs 전자) (DataContextChangedEventArgs 전자) System.Windows.FrameworkElement.NotifyDataContextChanged에서 (DataContextChangedEventArgs 전자) 시스템에서 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.FrameworkElement.OnAncestorDataContextChanged (DataContextChangedEventArgs 전자) System.Windows.DependencyObject.RaisePropertyChangeNotifications에서 System.Windows.FrameworkElement.OnPropertyChanged (DependencyProperty에 DP)에 System.Windows.FrameworkElement.NotifyDataContextChanged (DataContextChangedEventArgs 전자) 에서 (DependencyProperty에 DP에서 , 객체 newValue, 객체 oldValue) at System.Windows.DependencyObject.SetValueInternal (DP DependencyProperty에 개체 값 부울 allowReadOnlySet 부울 isSetByStyle 부울 isSetByBuiltInStyle, PropertyInvalidationReason 이유) System.Windows.DependencyObject.SetValueInternal에서 (DP DependencyProperty에 오브젝트 값)에 System.Windows.DependencyObject . SetValue (DependencyProperty dp, Object value) at System.Windows.FrameworkElement.set_DataContext (Object value) at Mobiltec.Atheneum.Reader.WindowsPhone.Controls.EbookPhotoSummary.hplMore_Click (Object sender, RoutedEventArgs e)at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.HyperlinkButton.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp MouseButtonEventArgs 전자) 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에서 .Input.UnsafeNativeMethods.CallWindowProc (lpPrevWndFunc을 IntPtr, HWND를 IntPtr, UINT32의 MSG,을 IntPtr의 wParam,을 IntPtr의 lParam) (lpPrevWndFunc을 IntPtr, HWND를 IntPtr, 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}"/> 

을 변경하고 모든 것이 잘 작동합니다. 감사합니다

답변

0

아쉽게도 Silverlight 프레임 워크에서 제공되는 오류는 여기 에서처럼 매우 모호합니다.

내가 줄 수있는 최선의 조언은 문제의 범위를 좁히는 것입니다. 이 문제를 나타내는 가장 작은 예제가되도록 코드를 단순화하십시오. 간략한 예제를 제공 할 수 있다면 질문을 업데이트하십시오. 지금은 대답하기가 모호합니다.