Ожидаемый результат будет примерно таким,
<Canvas Width="800" Height="600">
<Ellipse Stroke="#FF000000" StrokeThickness="2" Width="284" Height="288"
ToolTip="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Min}"
Canvas.Left="312" Canvas.Top="122" />
</Canvas>
С этим кодом,
//This will ultimately hold object of type UIElement, which is Ellipse in this case.
private DependencyObject selectedObject;
public void AddBinding(DependencyProperty dependencyProperty, DependencyProperty ipartProperty)
{
Binding binding = new Binding(ipartProperty.Name); //Here Name is Min, an attached property
binding.RelativeSource = new RelativeSource(RelativeSourceMode.TemplatedParent);
BindingOperations.SetBinding(selectedObject, dependencyProperty, binding);
}
Но фактический результат составляет
<Canvas Width="800" Height="600">
<Ellipse Stroke="#FF000000" StrokeThickness="2" Width="284" Height="288"
ToolTip="{x:Null}" Canvas.Left="312" Canvas.Top="122"/>
</Canvas>
Я не знаю, что не так, может кто-нибудь, пожалуйста, помогите