Search code examples
c#wpfxamldatatemplate

TargetType property not found on DataTemplate


<Grid>
    <ItemsControl ItemsSource="{Binding ScreenViewModelCollection}">
        <ItemsControl.Resources>
            <DataTemplate  x:Key="SomeKey" TargetType="{x:Type  local:RedScreenObject}">
                    <local:RedScreenObject/>
            </DataTemplate>
        </ItemsControl.Resources>
    </ItemsControl>
</Grid>

I have no idea why it can't see the TargetType property. Should be under Resources or ItemTemplate? I tried both it doesn't find it either way.

EDIT: In order to get blasted by more downvotes ha ha it was in reference to this: https://chat.stackoverflow.com/transcript/message/4295316#4295316


Solution

  • DataTemplate only has a DataType.