分享一个大佬写的界面跳转
这是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);
}
}
本文作者:孤沉
本文链接:https://www.cnblogs.com/guchen33/p/18342077
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步