0
<Window.Resources>
...
...
        <DataTemplate DataType="{x:Type my:Section}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Path=Name}"/>
                <TextBlock Text="  "/>
                <TextBlock Text="{Binding Path=Instructor}"/>
                <TextBlock Text="  "/>
                <TextBlock Text="{Binding Path=Cours}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate DataType="{x:Type my:Instructor}" x:Key="InstructorDataTemp">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Path=FirstName}"/>
                <TextBlock Text=" "/>
                <TextBlock Text="{Binding Path=LastName}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate DataType="{x:Type my:Cours}" x:Key="CourseDataTemp">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Path=Name}"/>
            </StackPanel>
        </DataTemplate>
...
...
</Window.Resources>

I am using the section template right now. The section template correctly displays the Section's Name, but the Instructor and Cours both show up as basic toStrings. I would like them to show up as defined in the other data templates. Any help is appreciated

Thanks

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by white feather
0

I solved it by using an IValueConverter for the instructor (in the section) and in the binding for the cours (in the section) just saying Cours.Name

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.