I am using Blend Visual Studio 2019, I have followed this post -https://stackoverflow.com/questions/9094486/adding-children-to-usercontrol
But I get this error:
Cannot set Name attribute value 'TextDateOrder' on element 'TextBlock'. 'TextBlock' is under the scope of element 'Box', which already had a name registered when it was defined in another scope. Line 14 Position 24.
I do understand the error, but do not know how to fix it.
How do I fix my error?
[ContentProperty(nameof(Children))]
public partial class Box : UserControl
{
public static readonly DependencyPropertyKey ChildrenProperty =
DependencyProperty.RegisterReadOnly(nameof(Children), typeof(UIElementCollection), typeof(Box), new PropertyMetadata());
public UIElementCollection Children
{
get { return (UIElementCollection)GetValue(ChildrenProperty.DependencyProperty); }
private set { SetValue(ChildrenProperty, value); }
}
public Box()
{
InitializeComponent();
Children = PART_Host.Children;
}
}