Reputation: 14108
Goal:
After clicking on the CRM button, the user control 3 shall be displayed in the mainwindows.
Problem:
I have difficult to create it because I do not know what source code and how to do it.
Information:
- User control 1 is menu with three buttons.
- The main windows will contain totally two user control.
- After you have click the CRM button you should enable to create a new instance of a user control 3 and it should be displayed inside of mainwindows.
- main Windows, User control 1 and 3 has ¨their own project in VS 2013,
Upvotes: 0
Views: 1510
Reputation: 1101
If I understood you correctly you need to display a usercontrol inside of a window when button is clicked ... if so, define a content control below your usercontrol with buttons, like this
EDIT: Also add the other 2 projects as a refrence to the mainwindow project.
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<UserControl Grid.Row="0"
x:Name="userControl1">
<Button Content="CRM"
Click="Button_Click" />
</UserControl>
<ContentControl Grid.Row="1"
x:Name="contentHolder" />
</Grid>
And then initialize your usercontrol and set it as the content of the ContentControl in the button click event handler Make sure to import the namespace of the referenced usercontrols project.
private void Button_Click(object sender, RoutedEventArgs e)
{
contentHolder.Content = new UserControl3();
}
Upvotes: 1