代码之家  ›  专栏  ›  技术社区  ›  A1exandr Belan

模板样式未设置某些首选项

  •  0
  • A1exandr Belan  · 技术社区  · 15 年前

    我有一个样式模板(下面),它不更新某些自定义控件属性。

    ...
        <Style x:Name="KeyboardButton" TargetType="Controls:KeyboardButton">
    ...
            <Setter Property="ArrowDirection" Value="Right" />
            <Setter Property="ArrowBeginColor" Value="Red" />
    
            <Setter Property="Template">
    ...
    

    arrowBeginColor ID颜色(不是画笔)类型的DependencyProperty。 如果不使用setter,则arrowBeginColor是DependencyProperty(New PropertyMetadata(colors.black))中的默认颜色black; 但当我在模板系统中使用setter时,无法获得颜色。搅拌机运行出错,而设置颜色为00000000。

    我做错什么了?为什么ArrowBeginColor不为我的自定义控件正确设置颜色?

    其他dp正常,仅dp颜色类型有问题。 Silverlight 4,与2010年相比。

    1 回复  |  直到 15 年前
        1
  •  0
  •   bendewey    15 年前

    你为什么用颜色类型而不是画笔?刷子在支持vs设计师和混合方面都要好得多。