[using VB.NET, but I can easily read C# code in responses]
I have a class called QuestionClipboard
with ALL shared methods/properties.
I previously had a QuesitonClipboard.doesClipboardHaveContent
function that returned true/false if there was a Object on my 'clipboard'.
I'd prefer to implement a Dependency Property so I can allow this true/false value to participate in data binding.
The "GetValue(dp as DependencyProperty)" method requires an object instance, which would mean that my Property CAN'T be shared!
Here is what the code would look like in my perfect world... Of course, the word "Shared" before the property declaration renders this code useless.
Private Shared clipboardHasContentPropertyKey As DependencyPropertyKey = DependencyProperty.RegisterReadOnly("clipboardHasContent", GetType(Boolean), GetType(QuestionClipboard), _
New PropertyMetadata(False, Nothing, New CoerceValueCallback(AddressOf coerceClipboardHasContent)))
Private Shared clipboardHasContentProperty As DependencyProperty = clipboardHasContentPropertyKey.DependencyProperty
Public SHARED Property clipboardHasContent As Boolean
Get
Return GetValue(clipboardHasContentProperty)
End Get
Set(ByVal value As Boolean)
SetValue(value)
End Set
End Property