(Level-1)
Scalar ---value
Enum ---value
String ---Value
Boolean ---value
Array
(Level-2)
-Array
(Level-3)
-Scalar ---value
-Enum ---value
-String ---Value
-Boolean ---value
-Scalar ---value
-Enum ---value
-String ---Value
-Boolean ---value
I have to display a treeview as shown in above tree. The level 1 items are enum,scalar,boolean,string,Array object. I have written templateSelector to select different template for each level 1 objects. I am able to write data template for level 1 types. But how to write template for "Array Type" because it again contains level 1 items as its items(level-2). same issue for level-3. Only 3 level are allowed.
<local:ParameterTemplateSelector x:Key="ParameterTemplateSelector"></local:ParameterTemplateSelector>
<DataTemplate x:Key="ScalarTemplate">
<StackPanel Orientation="Horizontal">
<Label FontWeight="Bold" Width="80" Content="{Binding parameterCode}"></Label>
<TextBox Text="{Binding Value.Item.Value}" Width="100" TextAlignment="Center"></TextBox>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="EnumTemplate">
<StackPanel Orientation="Horizontal">
<Label FontWeight="Bold" Width="80" Content="{Binding parameterCode}"></Label>
<TextBox Text="{Binding Value.Item.Value}" Width="100" TextAlignment="Center"></TextBox>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="StringTemplate">
<StackPanel Orientation="Horizontal">
<Label FontWeight="Bold" Width="80" Content="{Binding parameterCode}"></Label>
<TextBox Text="{Binding Value.Item}" Width="100" TextAlignment="Center"></TextBox>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="BooleanTemplate">
<StackPanel Orientation="Horizontal">
<Label FontWeight="Bold" Width="80" Content="{Binding parameterCode}"></Label>
<ComboBox Width="100" SelectedIndex="{Binding Value.Item, Converter={StaticResource boolToIndexConverter}}">
<ComboBoxItem Tag="1">True</ComboBoxItem>
<ComboBoxItem Tag="0">False</ComboBoxItem>
</ComboBox>
<!--<TextBox Text="{Binding Value.Item}" Width="100" TextAlignment="Center"></TextBox>-->
</StackPanel>
</DataTemplate>