Silverlight DependencyProperty.SetCurrentValue 等效项

发布于 2024-09-09 06:19:01 字数 342 浏览 1 评论 0原文

我正在寻找相当于 .NET 4 的 SL4 SetCurrentValue API,这似乎正是我的场景所需要的。

简而言之,我正在编写一个附加行为,它会在适当的时间更新给定属性的值。但是,我不希望它覆盖在该依赖项属性上设置的任何绑定。我只想将该值推送到属性(因此可以根据该值刷新任何绑定)。

据我所知,在 SL4 中还没有简单的方法可以做到这一点。

谢谢

I'm looking for a SL4 equivalent to .NET 4's SetCurrentValue API, which would appear to be exactly what I need for my scenario.

In short, I'm writing an attached behavior that updates the value of a given property at appropriate times. However, I don't want it to overwrite any bindings that are set on that dependency property. I merely want to push that value to the property (and therefore have any bindings refresh based on that value).

From what I can tell, there's no easy way to do this yet in SL4.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌路黄昏 2024-09-16 06:19:01

Silverlight 不提供对此级别的依赖值的直接访问。然而,故事板中的动画在操作属性时设置的正是这个级别的值。

因此,包含单个 DiscreteObjectKeyFrame 的持续时间长度为 0 的 Storyboard 可能会达到您想要的结果。

Silverlight does not provide direct access to this level of dependency value. However its this level of value that Animations in storyboards set when they manipulate a property.

Hence a Storyboard with a 0 length duration containing a single DiscreteObjectKeyFrame might achieve your desired result.

避讳 2024-09-16 06:19:01

我已经通过检测绑定并在源和目标之间注入代理对象来模拟我所追求的内容。然后我可以操纵代理并刷新原始绑定的两侧。

它很丑陋,而且比我想要的还要多,但它似乎有效。

肯特

I've managed to simulate what I'm after by detecting bindings and injecting a surrogate object between the source and target. I can then manipulate the surrogate and have both sides of the original binding refresh.

It's ugly and more work than I'd like, but it seems to work.

Kent

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文