I have the following XAML snippet and I want to include a generic parameter and I can't work out what I need to do?
I guess I'm going to have to created a markup extension to do this but I'm unsure how to get this to work with the x:Type attribute.
DataType="{x:Type vm:FooViewModel<Bar>}"
xaml file itself, the dictionary entry within generic. xaml can be a merged dictionary whose entries may reference anything.
WPF supports techniques that enable specifying the value of some properties of type Type without requiring an x:Type markup extension usage. Instead, you can specify the value as a string that names the type. Examples of this are ControlTemplate.
The generic argument list is a comma-separated list of type arguments. A type argument is the name of an actual concrete type that replaces a corresponding type parameter in the generic parameter clause of a generic type. The result is a specialized version of that generic type.
Check the Generics in XAML documentation to see if it fits your scenario. You'd need to use x:TypeArguments
; there are however some restrictions that you can check in the linked reference pages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With