none
【WP没有检测到已安装的组件。】是什么情况? RRS feed

  • 问题

  • 错误 1 没有检测到已安装的组件。
    Can only base on a Style with target type that is base type of this style's target type. D:\Documents\Visual Studio 2013\Projects\AppTest\AppTest\MainPage.xaml 42 9 AppTest

    ---------------------------------------------------------------------------------------------------------------------------------------------------------

         <Style x:Key="BasicStyle"
                   TargetType="ContentControl">
                <Setter Property="Width"
                        Value="100" />
                <Setter Property="Height"
                        Value="30" />
            </Style>
            
            <Style x:Key="ButtonStyle"
                   TargetType="Button"
                   BasedOn="{StaticResource BasicStyle}">--------------删除此句就没问题了,这是为什么呢?
                <Setter Property="BorderBrush"
                        Value="Orange" />
                <Setter Property="BorderThickness"
                        Value="2" />
                <Setter Property="Foreground"
                        Value="Orange" />

    2014年8月23日 11:20

答案

  • 楼主 你好,

    我们需要关注的错误信息其实是: "Can only base on a Style with target type that is base type of this style's target type".

    这是因为 BasicStyle 的 TargetType是 ContentControl, 这是一个FrameworkElement的类型。

    可以参考:http://stackoverflow.com/questions/1026635/setting-a-styles-targettype-property-to-a-base-class

    谢谢!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年8月25日 3:24
    版主