如何访问附加到 UI 元素的行为?
例如,我有这样的:
Border myBorder = new Border();
...
designArea.Children.Add(myBorder);
ResizeAndMoveBehavior b = new ResizeAndMoveBehavior();
b.CurrentProperties = thisButtonProperties;
b.Attach(myBorder);
现在,当我从 designArea 的子级获取 myBorder 时,如何访问附加到 myBorder 的行为的 CurrentProperties?
For example, I have this:
Border myBorder = new Border();
...
designArea.Children.Add(myBorder);
ResizeAndMoveBehavior b = new ResizeAndMoveBehavior();
b.CurrentProperties = thisButtonProperties;
b.Attach(myBorder);
Now when I get myBorder from the designArea's children how can I access the CurrentProperties of the behavior attached to myBorder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您以非标准方式附加您的行为,这意味着以后无法取回附加的行为。但是,如果您按照标准方式执行此操作,则可以获得此信息。以下是如何管理行为的示例。
You are attaching your behavior in a non-standard way, which means that there is no way to get the attached behavior(s) back later. However, if you do it the standard way, you can get this info. Here is an example of how behaviors should be managed.