Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data Bound TreeView Problem
Message
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
Data Bound TreeView Problem
Divers
Thread ID:
01465916
Message ID:
01465916
Vues:
91
I have a set of hierarchal data contained in classes that is loaded from a serialized XML file. Once deserialized, the objects have this
format:
Root
  |_ Groups
        |_Rules
             |_Conditions
                   |_ Actions
                   |_ Objects
I have set up the necessesary HierarchicalDataTemplates for the Groups, Rules, and Conditions, and they show fine in the TreeView.
I also set up a DataTemplate for the Actions and one for the Objects, but only Actions is showing. The reason is that because in
the HierarchicalDataTemplate for the Condition the ItemSource is pointing to Actions:
<!-- Condition -->
<HierarchicalDataTemplate DataType="{x:Type local:RuleCondition}" ItemsSource="{Binding Path=Actions, Mode=TwoWay}">
    <StackPanel Orientation="Horizontal">
        <Image Source="/RulesEngineUI;component/Media/bluedot.png" Height="8" Width="8" Margin="0,0,3,0"/>
        <TextBlock Margin="0,0,5,0" FontWeight="Bold">Condition:</TextBlock>
        <TextBlock>
            <Hyperlink Name="Link" Style="{StaticResource LinkStyle}" Click="Link_Click">
                <TextBlock Text="{Binding Path=Operation}"></TextBlock>
            </Hyperlink>
        </TextBlock>
    </StackPanel>
</HierarchicalDataTemplate>

<!-- Action -->
<DataTemplate DataType="{x:Type local:RuleAction}">
    <StackPanel Orientation="Horizontal">
        <TextBlock Margin="0,0,5,0" FontWeight="Bold">Action:</TextBlock>
        <TextBlock>
            <Hyperlink Name="Link" Style="{StaticResource LinkStyle}" Click="Link_Click">
                <TextBlock Text="{Binding Path=ActionField}"></TextBlock>
            </Hyperlink>
        </TextBlock>
    </StackPanel>
</DataTemplate>

<!-- Object -->
<DataTemplate DataType="{x:Type local:RuleObject}">
    <StackPanel Orientation="Horizontal">
        <TextBlock Margin="0,0,5,0" FontWeight="Bold">Object:</TextBlock>
        <TextBlock>
            <Hyperlink Name="Link" Style="{StaticResource LinkStyle}" Click="Link_Click">
                <TextBlock Text="{Binding Path=Field}"></TextBlock>
            </Hyperlink>
        </TextBlock>
    </StackPanel>
</DataTemplate>
If you look at the Condtion HierarchicalDataTemplate you see that it refers to actions. How do I tell the tree to also display the Objects
at the same level as the Actions?

K
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Répondre
Fil
Voir

Click here to load this message in the networking platform