瀏覽代碼

Создал пустую страницу

Alec 3 年之前
父節點
當前提交
feee064328

+ 4 - 1
WPF01/MainWindow.xaml.cs

@@ -24,7 +24,10 @@ namespace WPF01
         {
             InitializeComponent();
 
-            MainFrame.Navigate(new pages.Authorization());
+            PageNavigation.authorization = new pages.Authorization();
+            PageNavigation.mainPage = new pages.MainPage();
+
+            MainFrame.Navigate(PageNavigation.mainPage);
         }
 
         private void Frame_Loaded(object sender, RoutedEventArgs e)

+ 11 - 0
WPF01/PageNavigation.cs

@@ -0,0 +1,11 @@
+using System.Windows;
+using System.Windows.Controls;
+
+namespace WPF01
+{
+    class PageNavigation
+    {
+        public static pages.Authorization authorization;
+        public static pages.MainPage mainPage;
+    }
+}

+ 14 - 0
WPF01/WPF01.csproj

@@ -71,11 +71,19 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="pages\MainPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="PageNavigation.cs" />
     <Compile Include="pages\Authorization.xaml.cs">
       <DependentUpon>Authorization.xaml</DependentUpon>
     </Compile>
+    <Compile Include="pages\MainPage.xaml.cs">
+      <DependentUpon>MainPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -101,5 +109,11 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="images\Кирпич.jpg" />
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="images\linoleum-imitiruyuschiy-venge.jpg" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

二進制
WPF01/images/linoleum-imitiruyuschiy-venge.jpg


二進制
WPF01/images/Кирпич.jpg


+ 1 - 1
WPF01/pages/Authorization.xaml.cs

@@ -27,7 +27,7 @@ namespace WPF01.pages
 
         private void ButtonClick(object sender, RoutedEventArgs e)
         {
-            
+            NavigationService.Navigate(PageNavigation.mainPage);
         }
 
         private void TextBoxInput(object sender, KeyEventArgs e)

+ 29 - 0
WPF01/pages/MainPage.xaml

@@ -0,0 +1,29 @@
+<Page x:Class="WPF01.pages.MainPage"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:WPF01.pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="MainPage" Background="White">
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="42*"/>
+            <RowDefinition Height="107*"/>
+            <RowDefinition Height="14*"/>
+            <RowDefinition Height="112*"/>
+            <RowDefinition Height="146*"/>
+            <RowDefinition Height="29*"/>
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="36*"/>
+            <ColumnDefinition Width="146*"/>
+            <ColumnDefinition Width="386*"/>
+            <ColumnDefinition Width="199*"/>
+            <ColumnDefinition Width="33*"/>
+        </Grid.ColumnDefinitions>
+
+    </Grid>
+</Page>

+ 62 - 0
WPF01/pages/MainPage.xaml.cs

@@ -0,0 +1,62 @@
+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 WPF01.pages
+{
+    /// <summary>
+    /// Логика взаимодействия для MainPage.xaml
+    /// </summary>
+    public partial class MainPage : Page
+    {
+        public MainPage()
+        {
+            InitializeComponent();
+        }
+
+        private void Checkbox1_Click(object sender, RoutedEventArgs e)
+        {
+            CheckBox checkBox = sender as CheckBox;
+
+            if (checkBox == null)
+            {
+                return;
+            }
+
+            if (checkBox.IsChecked == true)
+            {
+                MessageBox.Show(checkBox.Content + " включен");
+            }
+            else
+            {
+                MessageBox.Show(checkBox.Content + " выключен");
+            }
+
+        }
+
+        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            ComboBox comboBox = sender as ComboBox;
+            if (comboBox != null)
+            {
+                comboBox.Items.Remove(comboBox.SelectedItem);
+            }
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+ 
+        }
+    }
+}