Hello guys!
It's a pretty long time since my last WPF code, so this is probably an easy question I just don't know the answer to.
I have a TreeView that contains different types:
Milestone, Issue, ProjectTask, etc.
Now dependent on the selected item I want to get an info panel filled.
I thought of something like this:
<StackPanel Orientation="Vertical" Grid.Column="1" DataContext="{Binding ElementName=ProjectTaskTreeView, Path=SelectedItem}">
<TextBlock Text="{Binding Id}"></TextBlock>
</StackPanel>
This works fine for an
Issue, but when I select a
MileStone I want to show the property
DisplayText instead of
Id and another additional TextBlock.
How can I achieve this the "most easy" or "best practice" way?
Is something similar to the following possible?
<StackPanel Orientation="Vertical" Grid.Column="1" DataContext="{Binding ElementName=ProjectTaskTreeView, Path=SelectedItem}">
<Content DataType="...Issue...">
<TextBlock Text="{Binding Id}"></TextBlock>
</Content>
<Content DataType="...MileStone...">
<TextBlock Text="{Binding DisplayText}"></TextBlock>
<TextBlock Text="{Binding AnotherPropertyOfMileStone}"></TextBlock>
</Content>
</StackPanel>
Thanks for your help! Markus