Environment:
Microsoft Visual Studio Professional 2019 Preview
Version 16.8.0 Preview 3.1
Issue:
Since information about runtime types is not available at design time, it's impossible to set a model property with the 'System.Type' type.
I tried setting a property value to TypeIdentifier:
var myTypeIdentifier = new TypeIdentifier("CustomControlLibrary.WpfCore.MyEnum");
ModelItem.Properties["MyType"].SetValue(myTypeIdentifier);
I also tried to set it to TypeDefinition:
var myTypeIdentifier = new TypeIdentifier("CustomControlLibrary.WpfCore.MyEnum");
var myTypeDefinition = MetadataFactory.ResolveType(ModelItem.Context, myTypeIdentifier );
ModelItem.Properties["MyType"].SetValue(myTypeDefinition);
However, none of these attempts was successful.
When I create TypeExtension using ModelFactory and set the TypeName property, the markup extension appears in XAML, but with a wrong type name. It doesn't contain an xmlns prefix:
var myTypeIdentifier = new TypeIdentifier("CustomControlLibrary.WpfCore.MyEnum");
var myTypeDefinition = MetadataFactory.ResolveType(ModelItem.Context, myTypeIdentifier );
var typeExtensionItem = ModelFactory.CreateItem(ModelItem.Context, new TypeIdentifier("System.Windows.Markup.TypeExtension"));
typeExtensionItem.Properties["TypeName"].SetValue(myTypeDefinition.FullName);
ModelItem.Properties["MyType"].SetValue(typeExtensionItem);
Environment: Microsoft Visual Studio Professional 2019 Preview Version 16.8.0 Preview 3.1
Issue: Since information about runtime types is not available at design time, it's impossible to set a model property with the 'System.Type' type.
I tried setting a property value to TypeIdentifier:
I also tried to set it to TypeDefinition:
However, none of these attempts was successful.
When I create TypeExtension using ModelFactory and set the TypeName property, the markup extension appears in XAML, but with a wrong type name. It doesn't contain an xmlns prefix:
Generated XAML:
It seems that design time has no public APIs to get an xmlns type prefix or add it to the root element.
Thanks.