0

I have a main view which contains a wrap panel, this wrappanel contains a list of usercontrols.

I get data into the usercontrol by using DependencyProperty, issue is how do i then bind in the wpf to variables in the usercontrol? if i use

DataContext="{Binding RelativeSource={RelativeSource Self}}"

it seems to stop the DependencyProperty from working

dfgnfgbc
  • 13
  • 4

1 Answers1

0

Give your control a name i.e.:

<UserControl x:Class="YourApp.YourNamespace"
    ... etc ...
    x:Name="_this">

Then all of its child controls can bind to its dependency properties like this:

<TextBlock Text={Binding ElementName=_this, Path=YourDependencyPropertyName}" />
Mark Feldman
  • 15,731
  • 3
  • 31
  • 58