UserControl's DataContext

前端 未结 5 1720
[愿得一人]
[愿得一人] 2020-11-29 23:47

I\'m creating a UserControl I want to use something like this:


5条回答
  •  感情败类
    2020-11-30 00:14

    You should be using

    {Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Color}
    

    for Databinding Related doubts always refer this sheet.
    http://www.nbdtech.com/Blog/archive/2009/02/02/wpf-xaml-data-binding-cheat-sheet.aspx

提交回复
热议问题