Why doesn't this SetBinding ImageSourceProperty Work?
let mtvCapView = Rendering.MTViewerCaptureViewProvider(subRead)
let image = Image()
let imageBinding = Data.Binding("ImageElement")
imageBinding.Source <- mtvCapView
image.SetBinding(Image.SourceProperty, imageBinding)
....
Grid.SetColumn(image, 1)
grid.Children.Add(image)
The MTViewerCaptureViewProvider class exposes an property ImageElement which is set and should work here. If I:
Grid.SetColumn(mtvCapView.ImageEle开发者_运维问答ment, 1)
grid.Children.Add(mtvCapView.ImageElement)
This works. Why does the other not?
If I look at the variable and property-names, I think you're trying to set an image as the image source of an image:
MTViewerCaptureViewProvider has a property ImageElement
. If the name is correct , it gives you already an Image
, not an ImageSource
. In the binding then your try to bind this image to the ImageSource of your newly created Image.
Maybe there existst a TypeConverter for Image
to ImageSource
that is implicitely used, but I don't think so. Try either to use the Image
itslelf or get the ImageSource
of the MTViewerCaptureViewProvider.ImageElement
.
If you work with VisualStudio look in the output-window. Binding exceptions will be shown there.
精彩评论