Advertisement
tuomasvaltanen

Untitled

Jan 20th, 2022
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. XAML:
  2.  
  3. <Page
  4. x:Class="UWPCourseApp2022.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:UWPCourseApp2022"
  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" Click="Button_Click">Tässä on testipainike</Button>
  15.  
  16. <TextBlock Width="428" HorizontalAlignment="Left" Margin="20" FontSize="30" Foreground="CornflowerBlue">Tervetuloa ohjelman käyttäjäksi!</TextBlock>
  17.  
  18. <TextBox Name="UserText" Margin="20"></TextBox>
  19.  
  20. <ComboBox Margin="20" Width="200">
  21. <ComboBoxItem>Banaani</ComboBoxItem>
  22. <ComboBoxItem>Omena</ComboBoxItem>
  23. <ComboBoxItem>Mansikka</ComboBoxItem>
  24. <ComboBoxItem>Hunajavesimeloni</ComboBoxItem>
  25. </ComboBox>
  26.  
  27. </StackPanel>
  28. </Page>
  29.  
  30. C#:
  31.  
  32. using System;
  33. using System.Collections.Generic;
  34. using System.Diagnostics;
  35. using System.IO;
  36. using System.Linq;
  37. using System.Runtime.InteropServices.WindowsRuntime;
  38. using Windows.Foundation;
  39. using Windows.Foundation.Collections;
  40. using Windows.UI.Xaml;
  41. using Windows.UI.Xaml.Controls;
  42. using Windows.UI.Xaml.Controls.Primitives;
  43. using Windows.UI.Xaml.Data;
  44. using Windows.UI.Xaml.Input;
  45. using Windows.UI.Xaml.Media;
  46. using Windows.UI.Xaml.Navigation;
  47.  
  48. // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
  49.  
  50. namespace UWPCourseApp2022
  51. {
  52. /// <summary>
  53. /// An empty page that can be used on its own or navigated to within a Frame.
  54. /// </summary>
  55. public sealed partial class MainPage : Page
  56. {
  57. public MainPage()
  58. {
  59. this.InitializeComponent();
  60. }
  61.  
  62. private void Button_Click(object sender, RoutedEventArgs e)
  63. {
  64. String txt = UserText.Text;
  65. Debug.WriteLine("Nappia on painettu!");
  66. Debug.WriteLine("Tervetuloa, " + txt);
  67. }
  68. }
  69. }
  70.  
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement