Advertisement
tuomasvaltanen

Untitled

Feb 24th, 2021 (edited)
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. XAML:
  2.  
  3. <Page
  4. x:Class="UWPCourseApp2021.MainPage"
  5. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  6. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  7. xmlns:local="using:UWPCourseApp2021"
  8. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  9. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  10. mc:Ignorable="d"
  11. Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  12.  
  13. <StackPanel>
  14. <Button Margin="20, 20, 20, 0" Click="Button_Click">Testipainike</Button>
  15. <TextBlock Margin="20, 20, 20, 0" Foreground="Indigo" FontSize="30">Tervetuloa ohjelman käyttäjäksi! Kirjoita alle nimesi:</TextBlock>
  16. <TextBox Name="UserText" Width="200" HorizontalAlignment="Left" Margin="20, 20, 20, 0"></TextBox>
  17.  
  18. <ComboBox Margin="20, 20, 20, 0">
  19. <ComboBoxItem>Auto</ComboBoxItem>
  20. <ComboBoxItem>Polkupyörä</ComboBoxItem>
  21. <ComboBoxItem>Potkukelkka</ComboBoxItem>
  22. </ComboBox>
  23.  
  24. </StackPanel>
  25. </Page>
  26.  
  27.  
  28. C#:
  29.  
  30. using System;
  31. using System.Collections.Generic;
  32. using System.Diagnostics;
  33. using System.IO;
  34. using System.Linq;
  35. using System.Runtime.InteropServices.WindowsRuntime;
  36. using Windows.Foundation;
  37. using Windows.Foundation.Collections;
  38. using Windows.UI.Xaml;
  39. using Windows.UI.Xaml.Controls;
  40. using Windows.UI.Xaml.Controls.Primitives;
  41. using Windows.UI.Xaml.Data;
  42. using Windows.UI.Xaml.Input;
  43. using Windows.UI.Xaml.Media;
  44. using Windows.UI.Xaml.Navigation;
  45.  
  46. // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
  47.  
  48. namespace UWPCourseApp2021
  49. {
  50. /// <summary>
  51. /// An empty page that can be used on its own or navigated to within a Frame.
  52. /// </summary>
  53. public sealed partial class MainPage : Page
  54. {
  55. public MainPage()
  56. {
  57. this.InitializeComponent();
  58. }
  59.  
  60. private void Button_Click(object sender, RoutedEventArgs e)
  61. {
  62. // ylös:
  63. // using System.Diagnostics;
  64. Debug.WriteLine("Nappi toimii!");
  65.  
  66. string result = UserText.Text;
  67. Debug.WriteLine("Terve " + result);
  68. }
  69. }
  70. }
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement