tags:

views:

32

answers:

2

Hi,

is there a way to declare an array of types in xaml?

maybe something like this?

 <x:Array Type="x:Type">
   <x:Type se:MyType1/> 
   <x:Type se:MyType2/> 
   <x:Type se:MyType3/>                                                                    
 </x:Array>
A: 

just have a look at this link

http://msdn.microsoft.com/en-us/library/ms752340.aspx and

http://stackoverflow.com/questions/1975067/missing-array-element-in-usercontrol-xaml

Kishore Kumar
i want an array of type Type. if you get what i meant......
icube
A: 

You need to use a different namespace prefix. x:Type is a markup extension that creates System.Type objects, and you want to create an array of type objects, not an array of markup extensions (I assume).

You cannot call constructors from when using element syntax, so you'll need to pass the type in using the Type property of TypeExtension.

Something like this should work:

<x:Array xmlns:sys="clr-namespace:System;assembly=mscorlib" Type="sys:Type">
    <x:Type Type="se:MyType1"/>
    <x:Type Type="se:MyType2"/>
    <x:Type Type="se:MyType3"/>
</x:Array>
Quartermeister
thanks... it works... :)
icube