WPF Designer DataTemplate.DataType cannot be type object

I was able to solve this WPF Designer Bug by adding a x:Key to the DataTemplate <ResourceDictionary> <DataTemplate x:Key=”ThisKeySolvesDesignersNullRef” DataType=”viewmodels:MyViewModel”> <views:MyView/> </DataTemplate> </ResourceDictionary> I had been searching for months, because it eventually appeared on different projects and sometimes appeared and disappeard without an explicit reason. Thanks to the helping answer on SO

What’s the purpose of the components IContainer generated by the Winforms designer?

When you add non-UI components to the form (such as a Timer component), components will be the parent of those compoments. The code in the designer file makes sure that these components are disposed of when the form is disposed. If you have not added any such components to the form in design time, components … Read more

Design-time-only background color in WPF?

There’s an undocumented property d:DesignStyle of type Style that you can set on a user control. This style is only applied in the designer and is not used at runtime. You use it like this: <UserControl … d:DesignStyle=”{StaticResource MyDesignStyle}” /> Or like this: <UserControl …> <d:DesignerProperties.DesignStyle> <Style TargetType=”UserControl”> <Setter Property=”Background” Value=”White” /> <Setter Property=”Height” Value=”500″ … Read more