Is it possible to set a style’s TargetType property in XAML to a Generic Class?
public class Selector<T> : Control { }
and then in xaml
<Style x:TargetType="Selector">
<Setter Property="MyProperty" Value="Green" />
</Style>
This wont work because Selector is missing a type argument.
You cannot bind to an open generic type like
List<T>, you can however bind to a closed generic type likeList<Person>by defining a placeholder type.C#:
XAML:
Update: You either need to specify
TargetTypeor thex:Keyproperty for a Style, not both.