locked
Implementing IXamlMetaDataProvider RRS feed

  • Question

  • Since the XamlTypeInfo.g.cs generation appears to be a bit buggy?/incomplete? at the moment, is there a way to implement IXamlMetadataProvider manually? 

    Better yet, is there just a code attribute to ensure a type gets included?

    -Graham

    Wednesday, October 12, 2011 8:53 PM

Answers

  • Graham -- the good thing is that everything you mentioned is known :-). 

    • DependencyProperty registration -- yes known and we already changed to match the type (instead of a string reference)
    • We are aware of the IXamlMetaDataProvider issue when not used in XAML and are looking at it
    • generic.xaml -- for the preview mark it as Content.  The lack of metadata codegen is known as an issue in the preview (no good workaround)
    • ItemsSource binding -- i'd like to learn more about this one and see a repro if you have it -- feel free to email me timheuer at microsoft
    • TestData - yes datacontext, data resources like this are known not to work in the developer preview
    • the %0 error is likely a parse exception.

    Can you explain your need/use case for TypeConverter as this is an area we are dicsussing.  You are correct that RadialBrush is not there.


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)
    Thursday, October 13, 2011 3:59 AM

All replies

  • Hi Graham, the developer preview does have issues...it is a preview :-)

    Can you describe some of the bugs you are seeing so we can ensure we are looking at them?


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)
    Wednesday, October 12, 2011 11:56 PM
  • Tim, 

    I'll consult my list tomorrow. But here are some issues I can remember off the top of my head:

    • Dependency properties need to have type Object because non-control non-primitive types are not ending up in generated provider.
    • Only classes actually referenced in the Xaml of the consuming app end up in the generated provider. What about types that are used internally or by composition?
    • Is generic.xaml for a class library supposed to be compiled as a page, or left as content and evaluated in the context of the consuming app's provider? If generic.xaml is page, nothing seems to get put in xamltypeinfo for the class library and so the xaml parse during the class library build fails. Not to mention that I'm guessing nothing would introduce this metadata to the consuming app.
    • Is there something amiss with the binding system? I was seeing this: ItemsSource="{Binding}" result in an actual binding object flow into the CLR wrapper for a dependency property. That doesn't seem like it should happen.
    • I tried to add some test data to a xaml files resource's <UserControl.Resources><local:TestData x:key:"data" /></UserControl.Resources> but this never gets added to the generated type provider. So the xaml parse fails. 
    • I was getting a very mysterious error at some point claiming it couldn't find type {%0} or something of that nature. Will see if I can replicate.

    I'll see what else I can come up with tomorrow. I realize its a preview, but we're trying to evaluate it for our uses and I just seem to be hitting nothing but roadblocks and odd omissions (Typeconverters? RadialBrushes?) so its a bit hard to sense how well things will work once the mushy stuff solidifies, so its hard to evaluate risk/timelines.

    The thing most troubling to me is that I can't sense the end game for the differences in the xaml parser. Are there lots of bits just missing at this point or does it just require a lot of hand holding?

    -Graham

    Thursday, October 13, 2011 3:41 AM
  • Graham -- the good thing is that everything you mentioned is known :-). 

    • DependencyProperty registration -- yes known and we already changed to match the type (instead of a string reference)
    • We are aware of the IXamlMetaDataProvider issue when not used in XAML and are looking at it
    • generic.xaml -- for the preview mark it as Content.  The lack of metadata codegen is known as an issue in the preview (no good workaround)
    • ItemsSource binding -- i'd like to learn more about this one and see a repro if you have it -- feel free to email me timheuer at microsoft
    • TestData - yes datacontext, data resources like this are known not to work in the developer preview
    • the %0 error is likely a parse exception.

    Can you explain your need/use case for TypeConverter as this is an area we are dicsussing.  You are correct that RadialBrush is not there.


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)
    Thursday, October 13, 2011 3:59 AM