Notes 목록을 표시하려고합니다. NoteViewModel 컬렉션에 바인딩 된 ItemsControl이 있습니다. 그래서 Items 컨트롤의 데이터 템플릿에서 NoteControl (노트 표시를위한 사용자 정의 컨트롤)을 만들고 ViewModel 속성을 컬렉션의 NoteViewModel에 바인딩하려고합니다.Silverlight에서 UserControls에 내부 ViewModels 연결
나는 현재이 있습니다
<ItemsControl x:Name="itemsControl1" Grid.Row="1" ItemsSource="{Binding Notes}" >
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer>
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemTemplate>
<DataTemplate>
<uc:NoteControl uc:NoteControl.ViewModel="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
를 그러나 나는이 예외 받고 있어요 :
System.ArgumentException: Object of type 'System.Windows.Data.Binding' cannot be converted to type 'NotePrototype.NoteViewModel'.
이를 배선에 대한 적절한 구문은 무엇입니까? 내부 뷰 모델을 동적으로 생성/바인딩 된 내부 UserControls에 연결하는 더 나은 기술이 있습니까? 그건 당신이
추가 메모를 ViewModel이되기 때문에
나는 이것을 얻지 못할까 봐 걱정된다. XAML은 ItemsControl의 ItemTemplate에서 어떤 모습입니까? – RationalGeek
감사합니다! 이제는 의미가 있습니다. :-) – RationalGeek