0

I have created two Usercontrols in my WPF Application! I want to access function of one Usercontrol via other. I just made one usercontrol parent of other and tried to access function of other but it generated Error that :

Error 2 The type 'EditStory' cannot have a Name attribute. Value types and types without a default constructor can be used as items within a ResourceDictionary.

My code is:

AllStories -- Parent UserControl

XAML-File

<dxdo:LayoutPanel Caption="Panel" Name="layoutPanel2">
                    <local:EditStory x:Name="editstorytab"/>
                </dxdo:LayoutPanel>

.CS File

public AllStories()
    {
        InitializeComponent();
        editstorytab.MyParent = this;

    }

EditStory -- Child UserControl

.Cs File

 public AllStories MyParent { get; set; }
    public EditStory(AllStories parent)
    {

        InitializeComponent();
         MyParent = parent;
         EditDataRefresh();
    }

Can anyone Solve my problem? :)

bland
  • 1,968
  • 1
  • 15
  • 22
user2835256
  • 407
  • 2
  • 13
  • 27

1 Answers1

0

From this answer:

Your base window apparently, as the error states, needs a public default contructor (one without arguments), it also may not be abstract because an instance of it needs to be created.

Community
  • 1
  • 1
Daniel
  • 10,864
  • 22
  • 84
  • 115