Xamarin.forms: SimpleValueTargetProvider does not expose ParentObjects property.

Created on 24 Jan 2019  Â·  3Comments  Â·  Source: xamarin/Xamarin.Forms

I am following along with the Creating XAML Markup Extensions docs and in the Service Providers section it mentions the SimpleValueTargetProvider.ParentObjects property. This property is not accessible because the IProvideParentValues interface that SimpleValueTargetProvider inherits is internal.

For some reason VS2017 intellisense exposes the property during debugging but it wont let you code with it. This ParentObects property would be super helpful. How can I access this?

question

Most helpful comment

@StephaneDelcroix I'd have to concur I have some scenarios as well where I need to evaluate the parent objects... it would really be great to open this API up

All 3 comments

You shouldn't use SimpleValueTargetProvider and expect that type to be returned whenever you request an IProvideValueTarget. The serviceProvider returned can depend on the context, and wether or not XamlC is enabled.

The point of ParentObjects is to implement IReferenceProvider, you might find what you need over there. We do not have plans to open ParentObjects as generating it is quite expensive, and we're still trying to see if we can avoid producing it.

hope it helps

The docs should be updated to not reference this then.

I reviewed ‘IReferenceProvider’ and this won’t help me. I need to be able to identify the parent hierarchy of a ‘TargetObject’ from within an ‘IMarkupExtension’. I need access to all the types so I can search for the one I want based on the type’e inheritance, not the name. Any ideas?

@StephaneDelcroix I'd have to concur I have some scenarios as well where I need to evaluate the parent objects... it would really be great to open this API up

Was this page helpful?
0 / 5 - 0 ratings