在资源字典中添加行为
我在应用程序中使用 Mark Smith 的 Julmar MVVM-Helpers 库,并希望将他的行为之一添加到我的所有文本框中。显然,这需要在资源字典中完成,但我在配置它们方面仍然是新手。
我想要做的是将以下行为添加
namespace JulMar.Windows.Interactivity
{
/// <summary>
/// This behavior selects all text in a TextBox when it gets focus
/// </summary>
public class SelectTextOnFocusBehavior : Behavior<TextBox>
{....
到我的所有文本框中。我找不到的是如何将其添加到资源字典中的语法。
I'm using Mark Smith's Julmar MVVM-Helpers library in an application and would like to add one of his behavior's to all my textboxs. Obviously, this needs to be done in a Resource dictionary, but I'm very much still a newbie at configuring them.
What I want to do is to add the below behavior
namespace JulMar.Windows.Interactivity
{
/// <summary>
/// This behavior selects all text in a TextBox when it gets focus
/// </summary>
public class SelectTextOnFocusBehavior : Behavior<TextBox>
{....
To all of my textboxes. What I cannot find is the syntax on how to add this in the resource dictionary.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设 SelectTextOnFocusBehavior 类在同一程序集中的 XAML 文件中使用,那么您需要执行以下操作:
Assuming the SelectTextOnFocusBehavior class is used in a XAML file in the same assembly, then you'd want to do something like: