각 사용자 정의 컨트롤을 TabItem에 포함하려면 TabControl을 사용자 정의 컨트롤에 바인딩하고 싶습니다.tabcontrol을 여러 사용자 정의 컨트롤에 바인딩하는 방법
TabControl 자체가 UserControl에 있음을 알면 가능합니까?
여기에 해당 UserControl에서 종속성 속성입니다 :이 코딩 할 때
<pyRGC:NavigationPane.ListUserControls>
<pyRGCTest:UC_1 />
</pyRGC:NavigationPane.ListUserControls>
, 그것은 저를 표시합니다 : "다음 유형이 예상 된 UserControl을 인 MainWindow를에서
public IList<UserControl> ListUserControls
{
get { return (IList<UserControl>)GetValue(ListUserControlsProperty); }
set { SetValue(ListUserControlsProperty, value); }
}
// Using a DependencyProperty as the backing store for ListUserControls. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ListUserControlsProperty =
DependencyProperty.Register("ListUserControls", typeof(IList<UserControl>), typeof(NavigationPane), new PropertyMetadata(new List<UserControl>()));
: "IList'1" ". XAML에서 IList를 사용하는 방법을 찾지 못했습니다.
어떻게하면됩니까?
감사
당신이 더 자세한 질문을 제공 할 수 있을까요? 시도한 것은 무엇이고, 그리고/또는 올바르게 작동하지 않는 것은 무엇입니까? – Andrew
사용자 정의 컨트롤에는 사용자 정의 컨트롤을 표시해야하는 TabControl이 있습니다. TabControl의 ItemsSource 속성을 소유하고있는 사용자 정의 컨트롤의 Dependency 속성에 바인딩하려고했습니다. 그러나 실제로 어떤 유형의 Dependency Property를 UserControl 목록에 사용해야하는지 알지 못합니다. 나는 그것이 좋은 접근인지 아닌지조차 모른다. – geckob
MVVM을 사용하는 경우 뷰 모델 모음을 ItemsSource에 바인딩 한 다음 각 viewmodel 유형에 대해 일부 DataTemplate을 제공 할 수 있습니다. – sthotakura