Binding to custom control inside DataTemplate for ItemsControl

前端 未结 1 575
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 08:49

I have a problem with bindings for DataTemplate based on defined DataType in ItemsControl, when I want to bind to my custom us

1条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 08:57

    The problem is that you explicitly set the DataContext of your UserControl to itself:

    DataContext="{Binding Mode=OneWay, RelativeSource={RelativeSource Self}}
    

    Remove that assignment and write the ItemName binding like this:

    
    

    or like this

    
    

    0 讨论(0)
提交回复
热议问题