0

I'm in a little bit of a pickel, here it is:

I have a MainWindow.xaml using a userControl. This latter needs a path to function properly and has it passed through a public string property.

The MainWindow is coupled with a viewmodel in which I do the work needed to create the path needed above.

Is there a clean way to set the userControl's path property from the MainWindow.xaml, such as for instance a binding to one of its viewmodel's properties? Something like

<uc:MyUserControl x:Name="controlsName" 
    PathPropertyNeeded="{Binding ViewModelsProperty}" />
4

2 回答 2

0

你需要一个依赖属性:

http://wpftutorial.net/DependencyProperties.html

于 2013-04-16T09:16:41.100 回答
0

是的,您只需要确保它PathPropertyNeeded是一个依赖属性

于 2013-04-16T09:11:42.803 回答