Compartilhar via


x:ClassModifier Attribute

Modifies XAML compilation behavior in cases where x:Class is also provided. Specifically, instead of creating a partial class with a Public access level (the default), the provided x:Class is created with a NonPublic access value. This affects the access level for the class in the generated assemblies.

Uso de atributos XAML

<object x:Class="namespace.classname" x:ClassModifier="NonPublic">
   ...
</object>

Valores de XAML

NonPublic

The exact string to pass to specify Public versus NonPublic varies, depending on the code-behind programming language being used. Consulte Comentários.

Dependências

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

Comentários

The value for the x:ClassModifier attribute will vary by programming language. The string to use will depend on how each language implements its CodeDomProvider and the type converters it returns to define the meanings for TypeAttributes.Public and TypeAttributes.NonPublic, and whether that language is case sensitive or not.

  • For C#, the string to pass to designate NonPublic is internal.

  • For Microsoft Visual Basic .NET, the string to pass to designate NonPublic is Friend.

  • For C + + / CLI, the C + + / CLI targets do not currently support compiling XAML.

You can also specify Public (public in C#, Public in Microsoft Visual Basic .NET) but that is uncommon, because Public as the behavior is already the default.

A value for Private (private in C#) is not relevant for x:ClassModifier, because nested class references are not supported in XAML, and thus the NonPublic modifier has the same effect.

Consulte também

Conceitos

Code-Behind e XAML

Windows Presentation Foundation Security

Referência

Atributo x:Class

x:FieldModifier Attribute