0

Example:

<UserControl x:Name="userControl"
    <StackPanel x:Name="container" Margin="0">
        <TextBox Text="{Binding Path=SettingValue, RelativeSource={RelativeSource Mode=Self}}"/>
    </StackPanel>
</UserControl>

UserControl contains SettingValue dependency property, TextBox doesn't, so this example won't work.

I could've done this if I had AncestorType, like in WPF:

RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControlType}

Is there any possibility to bind to UserControl.SettingValue property?

Dmitry Dyachkov
  • 1,715
  • 2
  • 19
  • 46

2 Answers2

1

Did you try the following? Use the ElementName source (the syntax might be a bit off).

 <TextBox Text="{Binding Path=SettingValue, ElementName=userControl"/>
R4cOOn
  • 2,340
  • 2
  • 30
  • 41
0

The answer I've found here:

Binding Silverlight UserControl custom properties to its' elements

Community
  • 1
  • 1
Dmitry Dyachkov
  • 1,715
  • 2
  • 19
  • 46