It seems like a straight forward task, i want to pass in a public property value from a MVVM View, but i keep getting the “a ‘binding’ cannot be set on the property of type . a ‘binding’ can only be set on a dependencyproperty of a dependencyobject” error.
I am iterate over an observable collection and rendering the item, and i would like to move some Template code into a User control. How the heck can i solve this????
<local:xIPAddressControl UserControlIPAddressText="{Binding Path=IPAddress, RelativeSource={RelativeSource Mode=Self}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
UserControl
public partial class xIPAddressControl : UserControl
{
public xIPAddressControl()
{
this.InitializeComponent();
}
public string UserControlIPAddressText
{
get { return this.xIPAddressTextBlock.Text; }
set { this.xIPAddressTextBlock.Text = value; }
}
}
Crazy thing, I was trying to set the User control incorrectly. It needs to be the following.
Tutorial is here.