The basic idea seems to work for me. Two areas that could be your trouble spots, but can't really tell you more without seeing your code.
It's tricky to get a reference to any part that comes from CreateFromXaml due to namescope issues. Do you know for sure that you've got a reference to your Path?
Path strings are tricky in and of themselves. It's really more of a design output format by intention. I'm not sure I'd be trying to crank them out on the fly unless you have a library that already does that for you.