这是Prism框架开发者写的一个demo,我觉得有趣,就发出来让大家看看
<StackPanel>
<StackPanel Orientation="Horizontal">
<Button x:Name="AnimationButton" Click="AnimationButton_Click" Content="Animation" Background="Transparent" BorderBrush="Transparent" Margin="0,0,5,0"/>
<Button x:Name="ConditionsButton" Click="ConditionalButton_Click" Content="Conditions" Background="Transparent" BorderBrush="Transparent" Margin="0,0,5,0"/>
<Button x:Name="DataBehaviorButton" Click="DataBehaviorButton_Click" Content="Data behaviors" Background="Transparent" BorderBrush="Transparent" Margin="0,0,5,0"/>
</StackPanel>
<Grid x:Name="MainContent"/>
</StackPanel>
public partial class MainWindow : Window
{
private AnimationPage animationPage;
private ConditionPage conditionPage;
private DataPage dataPage;
public MainWindow()
{
InitializeComponent();
animationPage = new AnimationPage();
conditionPage = new ConditionPage();
dataPage = new DataPage();
this.MainContent.Children.Add(animationPage);
}
private void AnimationButton_Click(object sender, RoutedEventArgs e)
{
this.MainContent.Children.Clear();
this.MainContent.Children.Add(this.animationPage);
}
private void ConditionalButton_Click(object sender, RoutedEventArgs e)
{
this.MainContent.Children.Clear();
this.MainContent.Children.Add(this.conditionPage);
}
private void DataBehaviorButton_Click(object sender, RoutedEventArgs e)
{
this.MainContent.Children.Clear();
this.MainContent.Children.Add(this.dataPage);
}
}
标签:界面,MainContent,animationPage,private,Add,跳转,大佬,Children,conditionPage
From: https://www.cnblogs.com/guchen33/p/18342077