locked
Possible Bug: Template's TargetType property does not match its control type

    Question

  • Hi

    I'm working on a C++ Metro style app. I use a resource dictionary from which I define styles for several controls, for example a group of radio buttons. The designer shows an error ("Template's TargetType property does not match  its control type") but only for the first of these buttons. I can't figure out any mistake, maybe there is one, but since I am able to compile I may assume that this is a bug.

    Simplified code for the controls inside my page:

    <RadioButton x:Name="m_btnTone0" Content="1" Style="{StaticResource ToneButton}"/>
    <RadioButton x:Name="m_btnTone1" Content="2" Style="{StaticResource ToneButton}"/>

    Simplified code for the style inside the dictionary:

    <Style x:Key="ToneButton" TargetType="RadioButton">
            <Setter Property="FontSize" Value="21.333"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="VerticalContentAlignment" Value="Bottom"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="ClickMode" Value="Press"/>
            <Setter Property="GroupName" Value="ToneButtonsGroup"/>
        </Style>

    Friday, March 30, 2012 7:40 AM

Answers

  • Peter,

    Thanks for reporting this issue. I am able to reproduce this on Beta builds and is a valid bug. This will be fixed in next release of Visual Studio.

    -Navit Saxena

    • Proposed as answer by navits - MSFT Saturday, March 31, 2012 12:00 AM
    • Marked as answer by peterGro Saturday, March 31, 2012 10:19 AM
    Saturday, March 31, 2012 12:00 AM