tags:

views:

25

answers:

1

Hi,

I have a customControl like ListView and I need to bind the sub property of my Custom Control to the visual tree element like below,

<StackPanel>    
    <TextBlock  Text="Test" x:Name="txtBlock" />
    <local:MyControl>
          <local:MyControl.Items>
                <local:MyControlItem Value ="{Binding ElementName=txtBlock, Path=Text}" />    
          </local:MyControl.Items>
    </local:MyControl>    
</StackPanel>

I can access the object using Freezable object as the resource, but i want to inherit Freezable in my MyControlItem and access the Visual Tree.

A: 

I found the solution in the following link,

http://drwpf.com/blog/2008/05/22/leveraging-freezables-to-provide-an-inheritance-context-for-bindings/

Ganesan