No, there isn't anything in the download to show adding the Behaviors themselves programmatically, just the completed UserControl.
But it should be pretty much the same. What kind of errors are you seeing? Are they related to the BoundaryHelper? Because there is an issue with Boundary Detection where elements must be drawn on the screen before their boundary can be determined. So if
you add a new UI element to your Canvas and then immediately try to AddPhysicsBodyForCanvasWithBehaviors, you'll get an error raised from the bounary detection.
There are a couple of ways around this:
1. Ensure that at least one instance of the element you want to add is on the Canvas when the Physics controls first start up. This will add the boundaries to the cache so that subsequent elements will re-use the boundary determination from the cache.
2. Have a delay between the time that you add the elements to the screen, and when you call the AddPhysicsBodyForCanvasWithBehaviors. This will allow the element to be drawn to the screen so the boundary detection can succeed. An empty StoryBoard is
the quickest way to create this delay - just use the Completed event and set the StoryBoard to 20 milliseconds or so.
(In your case sounds like you need Option #2 because you are adding Behaviors at runtime)
Hope this helps