내가 간단한 사용자 정의 사용자 컨트롤이 의존성 결합을 다음과 같이재산
<Grid x:Name="LayoutRoot">
<StackPanel>
<TextBlock Text="{Binding DisplayText}"/>
<TextBlock Text="{Binding PersonName}"/>
</StackPanel>
</Grid>
내가에서 MainPage.xaml에서 사용을 :
<local:WindowsPhoneControl1 x:Name="customControl" DisplayText="test">
</local:WindowsPhoneControl1>
MainPage.xaml.cs를 내가 할 경우 :
PersonName = "George";
customControl.DataContext = this;
그런 조지이 표시되지만 테스트은 그렇지 않습니다. 이것은 의미가 있지만 DisplayText 속성에 바인딩하는 방법을 모르겠습니다.
물론, 다음은이 표시되지 않습니다 조지 때문에 작동하지 않습니다
customControl.DataContext = customControl;
이는 WP/실버 라이트 개발을위한 작업을해야 있습니다, 그래서 AncestorType 같은 물건을하지 않을 수 있습니다 사용할 수 있습니다 (반드시 유용하지는 않습니다)
종속성 속성 값 우선 순위에 대한이 문서를 읽어야합니다. http://msdn.microsoft.com/en-us/library/ms743230.aspx – Guillaume