Witam, mam następujący problem w WPF.
Posiadam napisaną Customową kontrolkę, która ma w sobie m.in następujący kod:
public UIElement PresenterContent
{
get { return (UIElement)GetValue(PresenterContentProperty); }
set { SetValue(PresenterContentProperty, value); }
}
public static readonly DependencyProperty PresenterContentProperty =
DependencyProperty.Register("PresenterContent", typeof(UIElement), typeof(MyCustomControl));
Następnie, podczas używania tej kontrolki w oknie w osobnym projekcie binduję UIElement w sposób następujący:
<ndd:MyCustomControl PresenterContent="{Binding ElementName=SomeButton, Path=Name}"/>
Niestety skutkuje to zgłoszeniem następującego błędu:
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=Name; DataItem=null; target element is 'MyCustomControl'
Może mi ktoś wyjaśnić dlaczego tak się dzieje, i jak temu zaradzić? Z góry dziękuje za pomoc.