Try wrapping your DataTemplate
inside a UserControl
like this -
<DataTemplate>
<UserControl>
<Grid>
<VisualStateManager.VisualStateGroups>
...
</Grid>
</UserControl>
</DataTemplate>
Looks like any Control
that has got a Content
property will work. That's why UserControl
works, so does a ContentControl
.
So if you replace the UserControl
with a ContentControl
and give it an empty Style
. It should work too.
<Style x:Key="EmptyContentControlStyle" TargetType="ContentControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContentControl" />
</Setter.Value>
</Setter>
</Style>
<DataTemplate>
<ContentControl Style="{StaticResource EmptyContentControlStyle}">
<Grid>
<VisualStateManager.VisualStateGroups>
...
</Grid>
</ContentControl>
</DataTemplate>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…