10

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>}"
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152

1 Answers1

4

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.

jnovo
  • 5,659
  • 2
  • 38
  • 56
  • 3
    Unfortunately `x:TypeArguments` can only be used when creating a new instance - not in `DataType` – Paul Jan 02 '20 at 00:16