I have a base class with the following:
public class BodyBase : UserControl
{
}
I then have two WPF user controls (WelcomeBody and SettingsBody) that inherit that base like:
public partial class WelcomeBody : BodyBase
{
public WelcomeBody()
{
InitializeComponent();
}
}
I have also changed each XAML file to reflect this BaseBody and have no problem there. The designer is fine, and I can edit each control with no problem.
I placed BodyBase on my WPF form like so:
<my:BodyBase x:Name="ApplicationBody" SnapsToDevicePixels="True" Background="#FFAA1111" Panel.ZIndex="-99" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" />
I then have on button clicked:
private void WelcomeClick(object sender, RoutedEventArgs e)
{
MessageBox.Show("test");
ApplicationBody = new WelcomeBody();
}
Now at run time if I click the button, I get the message box, and then once I click ok on the message box nothing happens. I debugged and there are no exceptions thrown, nothings is wrong other than the fact it does not work.
What am I doing wrong? What do I need to do do get that user control to switch.
Thanks!
I had to do