Feb 23, 2012 at 7:16 PM

Does snoop currently support interaction behaviors and if not are there plans to add this functionality?

Feb 23, 2012 at 7:37 PM

What exactly do you mean by interaction behaviors?

Feb 23, 2012 at 11:10 PM
Edited Feb 23, 2012 at 11:13 PM

System.Windows.Interactivity.Behavior(of T)

The wpf system uses attached properties freezable collection attached property to add these behaviors.

Example Markup:

 <UserControl x:Class="SomeControNamel"








<v:SomeBehavior />

<v:SomeOtherBehavior SomeProperty="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type SomeControl}}, Path=DataContext.SomeBinding}" />





I can't find data for these behaviors.

Feb 24, 2012 at 4:51 PM

Are you saying that with Snoop ... you can't see these attached properties?

I just tried to find the Interaction.Behaviors attached property ... using Snoop ... and it wasn't able to see it ... which is odd since you can see other attached properties. I tried using Mole too ... and it wasn't able to see them either.

What is weird ... is that Snoop can see custom attached properties just fine ... so I'm not sure why Snoop can't see Interaction.Behaviors.

This is something to dive on it.

Can you confirm with me ... that this is indeed what you are trying to do?

Feb 24, 2012 at 6:36 PM
Edited Feb 27, 2012 at 5:03 PM


You are correct.  I also did some research on another attached property that I made that is built a lot like the interaction behaviors and was unable to see that property as well.  I believe the issue is Attached Property is a friend and the property string name is different than the property name.  I use this technique to bind across visual trees without the need for a spy.  I also use it for event command mapping collections.

Example of this type of Attached Property

   Public Class AttachedCollectionClass

#Region "SomeFreezableCollectionAttachedProperty"

' Make it Friend so WPF ignores the property and always uses the        

'public getter/setter. This is per John Gossman blog post - 07/2008.        

Friend Shared ReadOnly SomeFreezableCollectionAttachedProperty As DependencyProperty =           




New UIPropertyMetadata(Nothing, AddressOf OnMappingsChanged))

Friend Shared Function InternalGetMappingCollection(ByVal obj As DependencyObject) As SomeCustomFreezableCollection

Dim map = TryCast(obj.GetValue(SomeFreezableCollectionAttachedProperty), SomeCustomFreezableCollection)           

If map Is Nothing Then               

map = New BindingBridgeCollection()               

SetMappings(obj, map)           

End If           


Return map       

End Function

Public Shared Function GetSomeFreezableCollectionAttached(ByVal obj As DependencyObject) As SomeCustomFreezableCollection

Return InternalGetSomeFreezableCollectionAttachedCollection(obj)       

End Function


 Public Shared Sub SetSomeFreezableCollectionAttached(ByVal obj As DependencyObject, ByVal value As SomeCustomFreezableCollection)            obj.SetValue(MappingsProperty, value)       

End Sub

  Private Shared Sub OnMappingsChanged(ByVal target As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)           

Dim cec As SomeCustomFreezableCollection= TryCast(e.NewValue, SomeCustomFreezableCollection)
            If cec Is Nothing Then               


End If           

Dim _Element As ContentControl = TryCast(target, ContentControl)           

If _Element Is Nothing Then               


End If           

For Each item In cec               

item.Content= _Element           

        End Sub

#End Region

End Class

Public Class SomeCustomFreezableCollection

Inherits FreezableCollection(of ContentControl)

End Class 

Feb 27, 2012 at 10:36 PM

Would you like me to enter a more general thread referencing this under issue tracker?  I ask for your convenience as I don't know how you like to organize your issues.  

Feb 28, 2012 at 6:24 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 28, 2012 at 6:34 PM

Thanks ... I just copied this discussion to a work item:

To make it easy on us ... as we go to repro and work on this ... if you could attach a small test harness ... with a custom attached property like what you are discussing above ... and attach it to the issue in the Issue Tracker ... that would be awesome and helpful.

Feb 28, 2012 at 6:42 PM

NP... Will attach a quick example as soon as I can get a few free minutes to set one up.

Feb 29, 2012 at 7:15 PM seems to be locked right now.  I have a project ready to upload.