idemirel
idemirel

Reputation: 309

Binding UserControl in XAML

I am trying to bind a userControl that I create in a class as property. I couldnt figure out how to show it in XAML.

Example:

public class MainWindowViewModel : ViewModelBase
{
    public UserControl myUserControl { get; set; };

    public MainWindowViewModel()
        : base()
    {
        _myUserControl = new WelcomePageView());

    }
}

In XAML:

<Window c:Class=".."
   .
   .
   .
 />
<???? {Binding myUserControl}>
</Window>

Upvotes: 0

Views: 2010

Answers (1)

Elad Katz
Elad Katz

Reputation: 7591

Try

<ContentControl Content="{Binding your_usercontrol}" />

Upvotes: 3

Related Questions