What you're doing makes perfect sense, it just doesn't work with the way the PhysicsController is designed - because physics elements are processed at Load time.
You can still add elements dynamically, you just need to do it differently - if you look at "DemoBehaviors2" (the RagDoll demo) then there is an example in the button click. The key is the AddPhysicsBodyForCanvasWithBehaviors method (long
winded eh?) and below is an example.
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
void MainPage_Loaded(object sender, RoutedEventArgs e)
// NOTE that cnvGame is where you placed the PhysicsControllerBehavior
_physicsController = cnvGame.GetValue(PhysicsControllerMain.PhysicsControllerProperty) as PhysicsControllerMain;
private void btnAddDoll_Click(object sender, RoutedEventArgs e)
ucRagDoll _ucRagDollNew = new ucRagDoll();
_ucRagDollNew.SetValue(Canvas.LeftProperty, Convert.ToDouble(_rand.Next(50, 950)));