[Solved] How to pass data from WPF form to WPF usercontrol? [closed]


1)You can create public property in UserControl like:

public string SomeString
{
get;
set;
}

And then pass string by xaml:

<UserControl1 SomeString="String"/> 

or
bind SomeString property to property in your MainWindow

<UserControl1 SomeString="{Binding MyStr}"/>

2)You can pass your string to UserControl by constructor.

var uc = new UserControl(MyString);

solved How to pass data from WPF form to WPF usercontrol? [closed]