locked
Two-way binding with custom control RRS feed

  • Question

  • I've got a rather elaborate master-detail setup using a tabcontrol, a listcontrol and a custom control.

    I am using an objectdatasource with an observablecollection of RaceLines.  The tabs on the tabcontrol represent each RaceLine in the collection.  Each RaceLine has a collection of Races, which are presented on the panel (as a listcontrol) for each tab.  Each Race has a collection of CourseMarks which are displayed in a second listcontrol.

    The custom control has a dependency property called 'current race' which is bound to the selected item in first listcontrol.

    When i add a CourseMark to the customcontrol it updates the CurrentRace.CourseMarkCollection property, but this doesn't get updated on the first listcontrol so the second listcontrol doesn't update.

    I am binding to the custom control as follows

    <ChartControl ChartControl.CurrentRace="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Path=RaceCollection/.}">

    Am I missing something?

    Monday, May 29, 2006 12:35 PM

Answers

  • Kevin,

    Thanks for the reply, I can't remember exactly what the problem was, but I think it was a typo in the xpath for the listcontrol.

    Tuesday, August 29, 2006 7:46 AM

All replies

  • Have you tried binding a simple control (like a button) to the current item in your RaceCollection to make sure everything is being updated?

    Second, why are you using two-way binding?

    Third, RaceCollection is a collection that is a property on your data context, correct?

    Monday, August 28, 2006 8:12 PM
  • Kevin,

    Thanks for the reply, I can't remember exactly what the problem was, but I think it was a typo in the xpath for the listcontrol.

    Tuesday, August 29, 2006 7:46 AM