WPF binding to Listbox selectedItem

前端 未结 5 1381
再見小時候
再見小時候 2020-12-13 18:19

Can anyone help with the following - been playing about with this but can\'t for the life of me get it to work.

I\'ve got a view model which contains the following p

5条回答
  •  借酒劲吻你
    2020-12-13 18:36

    Yocoder is right,

    Inside the DataTemplate, your DataContext is set to the Rule its currently handling..

    To access the parents DataContext, you can also consider using a RelativeSource in your binding:

    
    

    More info on RelativeSource can be found here:

    http://msdn.microsoft.com/en-us/library/system.windows.data.relativesource.aspx

提交回复
热议问题