<DataTemplate DataType="{x:Type vm:SampleViewModel}">
<DataTemplate.Resources>
<DataTemplate DataType="{x:Type vm:SampleViewModel}" x:Key="BoolSampleViewModelTemplate">
<CheckBox IsChecked="{Binding Value}"/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:SampleViewModel}" x:Key="StringSampleViewModelTemplate">
<TextBox Text="{Binding Value}"></TextBox>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:SampleViewModel}" x:Key="DoubleSampleViewModelTemplate">
<TextBox Text="{Binding Value, StringFormat='{}{0:C}'}"/>
</DataTemplate>
</DataTemplate.Resources>
<ContentControl Content="{Binding}" Name="presenter" />
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Type}" Value="{x:Type sys:Boolean}">
<Setter TargetName="presenter" Property="ContentTemplate" Value="{StaticResource BoolSampleViewModelTemplate}" ></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="{x:Type sys:Double}">
<Setter TargetName="presenter" Property="ContentTemplate" Value="{StaticResource DoubleSampleViewModelTemplate}" ></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="{x:Type sys:String}">
<Setter TargetName="presenter" Property="ContentTemplate" Value="{StaticResource StringSampleViewModelTemplate}" ></Setter>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
<DataTemplate.Resources>
<DataTemplate DataType="{x:Type vm:SampleViewModel}" x:Key="BoolSampleViewModelTemplate">
<CheckBox IsChecked="{Binding Value}"/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:SampleViewModel}" x:Key="StringSampleViewModelTemplate">
<TextBox Text="{Binding Value}"></TextBox>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:SampleViewModel}" x:Key="DoubleSampleViewModelTemplate">
<TextBox Text="{Binding Value, StringFormat='{}{0:C}'}"/>
</DataTemplate>
</DataTemplate.Resources>
<ContentControl Content="{Binding}" Name="presenter" />
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Type}" Value="{x:Type sys:Boolean}">
<Setter TargetName="presenter" Property="ContentTemplate" Value="{StaticResource BoolSampleViewModelTemplate}" ></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="{x:Type sys:Double}">
<Setter TargetName="presenter" Property="ContentTemplate" Value="{StaticResource DoubleSampleViewModelTemplate}" ></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="{x:Type sys:String}">
<Setter TargetName="presenter" Property="ContentTemplate" Value="{StaticResource StringSampleViewModelTemplate}" ></Setter>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>