Partager via


x:TypeArguments Attribute

Passes required constraints to the constructor for a generic type.

XAML Attribute Usage

<object x:Class="namespace.classname" x:TypeArguments="{x:Type type1}[,{x:Type type2},{x:Type type3,...}]">
   ...
</object>

XAML Values

namespace

Optional. Specifies a CLR namespace that contains the partial class identified by classname. If namespace is specified, a dot (.) separates namespace and classname.

classname

Required. Specifies the CLR name of the partial class that connects the loaded XAML and your code-behind for that XAML.

type1type2type3, ...

Typename of the types to use to constraint the generic instance. The [ and ] in the syntax are not literals; they denote that any more than one type passed to x:TypeArguments is optional. If more than one type is passed, they must each be separated by a comma (,).

Dependencies

x:Class Attribute must also be provided on the same element, and that element must be the root element in a page.

Remarks

This attribute is only usable for the root element, with x:Class specified for that generic type, and only when that root element maps to a generic type with at least one type argument. An example is PageFunction.

If the generic has a single type argument, the attribute value is a single type reference, with type specified as attribute value using the x:Type Markup Extension syntax. If the generic has multiple type arguments, the multiple type references are separated by commas within the attribute value.

See Also

Reference

x:Class Attribute
x:Type Markup Extension

Concepts

XAML and Custom Classes