Master detail Binding RRS feed

  • Question

  • In a Master detail realationship, I mite have flight segment records sometimes twice or thrice. So in this xaml, the header will appear for all the records separately. How to handle the header in this case??

    Expander Header="Air Availabilty and Schedule">
    <ItemsControl ItemsSource="{Binding Source={StaticResource Response}, Path=OriginDestinationFlightLists}">
    <Expander Header="Origin Destination">
    <ItemsControl ItemsSource="{Binding Path=FlightList}">
    <ListView ItemsSource="{Binding Path=FlightSegment}">
    <GridViewColumn Header="" CellTemplate="{StaticResource CheckboxTemplate}"/>
    <GridViewColumn Header="Type" CellTemplate="{StaticResource BookingTypeCellDataTemplate}" />
    <GridViewColumn Header="Airline" CellTemplate="{DynamicResource FlightNumberTemplate}" />
    <GridViewColumn Header="Orgin" CellTemplate="{DynamicResource DepartureAirportTemplate}" />
    <GridViewColumn Header="Destination" CellTemplate="{DynamicResource ArrivalAirportTemplate}" />
    <GridViewColumn Header="Departure Date &amp; Time" DisplayMemberBinding="{Binding Path=FlightSegments/DepartureDateTime}" />
    <GridViewColumn Header="Arrival Date &amp; Time" DisplayMemberBinding="{Binding Path=FlightSegments/ArrivalDateTime}" />
    <GridViewColumn Header="Stops" DisplayMemberBinding="{Binding Path=FlightSegments/StopQuantity}" />
    <GridViewColumn Header="Equipment" DisplayMemberBinding="{Binding Path=FlightSegments/EquipmentType}" />
    <GridViewColumn Header="Duration" DisplayMemberBinding="{Binding Path=FlightSegments/FlightDuration}" />


    Sunday, April 20, 2008 7:05 PM

All replies

  •  There are a number of ways to do this.  The easiest might be to use a grid as a template for your itemscontrol.  Thus, you would have 1 grid containing your header and another grid containing your items (you could do this by using a Grid as your datatemplate or by overriding the listview panel).  By doing this, you can use the SharedSizeGroup property of a column to keep the width and positions of the columns from your header grid and your items grid in sync.  Look at some examples using SharedSizeGroup and some examples of customizing the panel used in a list (whether that be a listview or just the itemspanel of the itemscontrol).  Merging those two examples together should give you your solution.

    Tuesday, April 29, 2008 4:05 PM