ServiceTree
コントロールに次のマークアップがありTreeView
、サービスの を に表示する必要がありServiceGroup
ます。
<Grid>
<TreeView ItemsSource="{Binding Services}" DataContext="{Binding}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}" DataType="{x:Type businessService:BusinessService}">
<TreeViewItem Header="{Binding Name}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
最上位バインディングでServices
は、 に属するサービスのコレクションですServiceGroup
。
メイン ウィンドウで、次のデータ バインディングを使用してOdysseyプロジェクトOdcExpander
からを作成します。
<ItemsControl.ItemTemplate>
<DataTemplate DataType="groups:ServiceGroup">
<odc:OdcExpander Header="{Binding UIMetadata.MenuText}" HeaderBackground="{Binding UIMetadata.MenuTabBackColor}">
<XTime900Shell:ServiceTree />
</odc:OdcExpander>
</DataTemplate>
</ItemsControl.ItemTemplate>
これは機能します。それぞれに正しくバインドされた1つのエキスパンダーを取得ServiceGroup
しますが、サービスを含むグループ、つまり「従業員」グループには、表示するサービスの数に高さが比例するツリービューが必要なスペースがあるため、バインドされていますコレクションプロパティ、Services
および各サービスのアイテムを作成しますが、正しく入力されていることがわかっているサービスの「名前」プロパティには何も表示されません。