no problems...">

Declare TargetType Type for NestedClass in WPF

I have a class MyClass.
I announce

<Style TargetType="local:MyClass"></Style>

no problems.

I have a class MyClass.MyNestedClass(public).

Announcing ...?

+3
source share
2 answers

You need to use a + to separate the outer class name from the nested class name:

<Style TargetType="local:MyClass+MyNestedClass"></Style>
+7
source

You cannot declare nested classes in XAML (afaik), as this interferes with the Xaml parsing logic, which assumes dot notation represents a property

0
source

Source: https://habr.com/ru/post/1776890/


All Articles