Silverlight dependency property not updating

Receiving notifications for dependency property changes on an existing object is a very common scenario in order to update my view model or the UI.This is quite easy in WPF: does exist in Silverlight.😛 ) The first solution you might think about is setting the default value of the Dependency Property’s default value.Maybe –1 for example, so that at least the engine can detect a change.In order to get a workaround I found a solution in which I get notified with help of the binding system.I simple use a relay object which value property is bound to the source property I want to get notified.Here you can find a demo project with full source code. I noticed while working with Attached Properties and Dependency Properties that the code snippet is wrong. My guess is that this is an older version of the Register methods.

By defining its Property Metadata, a class can define the dependency property's behaviors, such as its default value and property system callbacks.

In the following example, the custom class Public Class My State Control Inherits Button Base Public Sub New() My Base.

New() End Sub Public Property State() As Boolean Get Return CType(Me.

The relay object contains a public event which raises when the value changes.

I’ve put the implementation details into a It is not possible to listen for dependency property values which are inherited like the Font Size, Data Context and Font Family properties so far.

Leave a Reply