Issue with DependencyProperty binding

后端 未结 3 593
渐次进展
渐次进展 2020-11-21 16:07

I created a small File Browser Control:



        
3条回答
  •  自闭症患者
    2020-11-21 16:57

    Using this:

    The FileBrowserControl's DataContext has already been set to itself, therefore you are effectively asking to bind to the SelectedFile where the DataContext is the FileBrowserControl, not the parent ViewModel.

    Give your View a name and use an ElementName binding instead.

    SelectedFile="{Binding DataContext.SelectedFile, ElementName=element}"
    

提交回复
热议问题