DesignModeValueProvider 构造函数
[本文档仅供预览,在以后的发行版中可能会发生更改。包含的空白主题用作占位符。]
初始化 DesignModeValueProvider 类的新实例。
命名空间: Microsoft.Windows.Design.Model
程序集: Microsoft.Windows.Design.Interaction(在 Microsoft.Windows.Design.Interaction.dll 中)
语法
声明
Public Sub New
public DesignModeValueProvider()
public:
DesignModeValueProvider()
new : unit -> DesignModeValueProvider
public function DesignModeValueProvider()
异常
异常 | 条件 |
---|---|
InvalidOperationException | 将无效属性添加到 Properties。 |
备注
在该构造函数中标识要捕获的属性。 通过将这些属性添加到 Properties 来标识这些属性。
示例
下面的示例将 Background 和 Content 属性标识为要捕获的属性。 当用户更改这些属性时,新值由 TranslatePropertyValue 方法提供。 此代码示例摘自为 DesignModeValueProvider 类提供的一个更大的示例。
有关更多信息,请参见 演练:在设计时更改属性的行为。
Public Sub New()
Properties.Add(GetType(Button), "Content")
Properties.Add(GetType(Button), "Background")
End Sub
public CustomButtonDesignModeValueProvider()
{
Properties.Add( typeof(Button), "Content");
Properties.Add(typeof(Button), "Background");
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.Windows.Design.Model 命名空间