2012-07-10 2 views

답변

0

나는 당신의 질문을 이해할 수 있는지 안다. 그러나 listbox itemssource가 질문의 집합 일 때 각 항목에 대한 datacontext는 질문입니다. 그래서 모든 항목에 대해 목록 상자는 질문에 설정 한 datacontext와 함께 questioncontrol을 만듭니다.

<ListBox ItemsSource="{Binding QuestionEntityList}"> 
      <ListBox.ItemTemplate> 
       <DataTemplate> 
        <Grid> 
         <my:QuestionControl />//one questioncontrol for each item in the collection, the dataconext is set to this item automatically 
        </Grid> 
       </DataTemplate> 
      </ListBox.ItemTemplate> 
    </ListBox> 
+0

내 나쁜 영어 ... 영어 매우 가난 : 나는 방법은 마지막의 DataContext에 entiy 액세스로드 UserControl을보십시오. 각 QuestionControl 항목에 대한 각 엔티티 항목 바인딩에 대해 확인하십시오. 원하는 경우 QuestionControl (코드 숨김)에서 바인드 된 엔터티 개체에 액세스합니다. – user1516238

0

나는 내 문제를 해결합니다. UserControl initialize 메서드에서 바인딩 된 개체 (엔티티)에 액세스하려고 시도하고 datacontext가 항상 null을 반환합니다. S

미안 내 죄송