分享一个大佬写的界面跳转

这是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 中国大陆许可协议进行许可。

posted @   孤沉  阅读(8)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
展开