Silverlight DependencyProperty.SetCurrentValue Equ

2019-07-15 18:45发布

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

2条回答
Root(大扎)
2楼-- · 2019-07-15 19:06

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

查看更多
再贱就再见
3楼-- · 2019-07-15 19:25

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.

查看更多
登录 后发表回答