我的WPF視窗程設模板_同個介面上的頁面跳轉_不顯示上方醜陋工具列_供下載
許多程式在介面要求會希望能夠有擴充性及重複利用性
所以就會存起來之後可以立即使用
因此就會誕生了 「模板」 這個詞
常見的像是 網頁的 或是 視窗的 都有 大概小提一下 哈哈
終於在 WPF上 做出來了 嗚嗚嗚 感動
效果
介面部分程式區塊
MainWindow.xaml
頁面跳轉的程式
功能部分的程式區塊
MainWindow.xaml.cs
載點
https://www.dropbox.com/s/58o6qxo7jewc3n5/photobooth_KinectV2.7z?dl=0
所以就會存起來之後可以立即使用
因此就會誕生了 「模板」 這個詞
常見的像是 網頁的 或是 視窗的 都有 大概小提一下 哈哈
終於在 WPF上 做出來了 嗚嗚嗚 感動
效果
介面部分程式區塊
MainWindow.xaml
<Window x:Class="photobooth_KinectV2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:photobooth_KinectV2"
        mc:Ignorable="d"
        Title="MainWindow" Height="600" Width="900"
        WindowStartupLocation="CenterScreen"
        WindowStyle="None"
        >
    <Canvas>
        <Grid x:Name="Page1" Height="600" Width="900">
            <TextBlock x:Name="Page1Text" Text="This is Page1" FontSize="20"/>
            <Button x:Name="btnPage2" Content="toPage2"  Margin="623,517,0,38"  Width="218"  Height="45" Click="btnPage2_Click"/>
        </Grid>
        <Grid x:Name="Page2" Height="600" Width="900" Canvas.Left="900">
            <TextBlock x:Name="Page2Text" Text="This is Page2" FontSize="20"/>
            <Button x:Name="btnBackPage1" Content="toPage1"  Margin="38,520,644,35"  Width="218"  Height="45" Click="btnBackPage1_Click"/>
            <Button x:Name="btnNextPage3" Content="toPage3"    Width="218"  Height="45" Margin="632,520,50,35" Click="btnNextPage3_Click"/>
        </Grid>
        <Grid x:Name="Page3" Height="600" Width="900" Canvas.Left="1800">
            <TextBlock x:Name="Page3Text" Text="This is Page3" FontSize="20"/>
            <Button x:Name="btnBackPage2" Content="toPage2"  Margin="38,520,644,35"  Width="218"  Height="45" Click="btnBackPage2_Click"/>
        </Grid>
    </Canvas>
</Window>
頁面跳轉的程式
功能部分的程式區塊
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace photobooth_KinectV2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        Grid g;
        public MainWindow()
        {
            InitializeComponent();
        }
        private void btnPage2_Click(object sender, RoutedEventArgs e)
        {
            swithchPage(Page1,Page2);
        }
        private void btnBackPage1_Click(object sender, RoutedEventArgs e)
        {
            swithchPage(Page2, Page1);
        }
        private void btnNextPage3_Click(object sender, RoutedEventArgs e)
        {
            swithchPage(Page2, Page3);
        }
        private void btnBackPage2_Click(object sender, RoutedEventArgs e)
        {
            swithchPage(Page3, Page2);
        }
        private void swithchPage(Grid preGrid , Grid nextGrid)
        {
            preGrid.Visibility = Visibility.Collapsed;
            g = nextGrid;
            Canvas.SetLeft(g, 0);
            Canvas.SetTop(g, 0);
            nextGrid.Visibility = Visibility.Visible;
            g.BringIntoView();
        }        
    }
}
載點
https://www.dropbox.com/s/58o6qxo7jewc3n5/photobooth_KinectV2.7z?dl=0
留言
張貼留言