我想创建具有扩展功能的WPF TextBox的类库(dll文件)。但是我想更改文本框默认样式的一部分(IsMouseOver属性触发器)。
我创建了一个新的WPF用户控件库项目,从中删除了生成的.XAML和.cs文件,并添加了一个新的类文件。然后,我派生自TextBox类,但我不知道如何访问样式XAML。
我不知道应该怎么做。
在我的项目中,我目前仅具有此.cs文件,而没有.XAML文件:
namespace CustomControls
{
public class CustomTextBox : TextBox
{
private string customProperty;
public string CustomProperty
{
get { return customProperty; }
set { customProperty = value; }
}
}
}
Run Code Online (Sandbox Code Playgroud)