Drawing a WPF UserControl with DataBinding to an Image

前端 未结 3 2113
礼貌的吻别
礼貌的吻别 2020-12-09 00:58

So I\'m trying to use a WPF User Control to generate a ton of images from a dataset where each item in the dataset would produce an image...

I\'m hoping I can set it

3条回答
  •  眼角桃花
    2020-12-09 01:26

    I think the problem is in the binding, as you suspect. Instead of creating a property Booking, try setting the DataContext of the ImageTemplate instance, then set the Path on the bindings to only the property name of the data object you want to use. It may not solve your problem, but it's a more standard way of doing the binding.

    
    

    Should be all you need to make the binding work if you set the data context to a Booking instance. Try it and let us know if it works.

提交回复
热议问题