내가 콤보처럼 (DataContext를 바인딩하지 않고) 직접 XAML로 항목의 컬렉션을 받아들이는 사용자 정의 컨트롤을 만들려고 해요 : 내 컨트롤의 클래스에서,항목이 xaml에 정의 된 UC?
<ComboBox>
<ComboBoxItem Content="test"/>
<ComboBoxItem Content="test2"/>
<ComboBoxItem Content="test3"/>
</ComboBox>
또한, 내가 원하는 XAML에서 UC 내에 입력 된 항목 목록을받습니다. 이것이 가능한가?
** 편집 **
내가 여러 목록 말하자면, 세 가지 목록을받을 필요:
<MyControl>
<MyControl.FirstCollection>
<MyControlItem Content="test"/>
<MyControlItem Content="test2"/>
<MyControlItem Content="test3"/>
</MyControl.FirstCollection>
<MyControl.SecondCollection>
<MyControlItem Content="test4"/>
<MyControlItem Content="test5"/>
<MyControlItem Content="test6"/>
</MyControl.SecondCollection>
<MyControl.LastCollection>
<MyControlItem Content="test7"/>
<MyControlItem Content="test8"/>
<MyControlItem Content="test9"/>
</MyControl.LastCollection>
</MyControl>
가 어떻게이 세 가지 목록을받을 수 있습니까?
중복 (http://stackoverflow.com/questions/9094486/adding-children-to-usercontrol). 나는 받아 들인 대답에서 해결책을 사용하고있다 완전하게 작동한다. –
좋은 해결책이지만 컨테이너를 사용하여 항목을 보이게하고 싶지는 않지만 Children 컨트롤을 가져 와서 List 또는 Collection에 넣기를 원합니다. – Guilherme
이전 의견을 이해할 수 있는지 잘 모르겠습니다. "용기 사용"이란 무엇을 의미합니까? –