【问题标题】:Style Xaml Label in ResourceDictionaryResourceDictionary 中的样式 Xaml 标签
【发布时间】:2014-03-04 08:36:16
【问题描述】:

我正在尝试为 Silverlight/XAML/C# 中的标签控件定义样式。

我是新手,所以请原谅我的无知。

当我编写以下代码时,IDE 显示标签 在 silverlight 项目中支持

那么我该如何为这个标签定义一个样式类型呢?

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">


    ...
    <Style x:Key="TitleFontStyle" TargetType="sdk:Label"> 
        <Setter Property="Background" Value="{StaticResource ButtonBackgroundGradientBrush}" /> 

    </Style> 
</ResourceDictionary>

【问题讨论】:

标签: silverlight xaml silverlight-5.0 blend


【解决方案1】:

这是因为你没有引用 sdk 命名空间。

包括这个:

xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"

在资源字典的顶部,然后进行清理和重建,它应该可以工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-25
    • 2020-07-27
    • 1970-01-01
    • 1970-01-01
    • 2010-11-16
    • 1970-01-01
    • 2013-03-03
    相关资源
    最近更新 更多