Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- XAML:
- <StackPanel Margin="20">
- <TextBlock FontSize="50">TOINEN SIVU</TextBlock>
- <CheckBox>Olen lukenut ja ymmärtänyt ehdot</CheckBox>
- <TextBlock>Haluatko uutiskirjeen?</TextBlock>
- <RadioButton GroupName="NewsLetter">Kyllä</RadioButton>
- <RadioButton GroupName="NewsLetter">En</RadioButton>
- <TextBlock>Valitse kieli:</TextBlock>
- <RadioButton GroupName="AppLanguage">Suomi</RadioButton>
- <RadioButton GroupName="AppLanguage">Svenska</RadioButton>
- <RadioButton GroupName="AppLanguage">English</RadioButton>
- </StackPanel>
- -------------------
- <Page
- x:Class="UWPCourseApp2022.SecondPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:UWPCourseApp2022"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d"
- Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
- <StackPanel Margin="20">
- <TextBlock FontSize="50">TOINEN SIVU</TextBlock>
- <CheckBox>Olen lukenut ja ymmärtänyt ehdot</CheckBox>
- <TextBlock>Haluatko uutiskirjeen?</TextBlock>
- <RadioButton GroupName="NewsLetter">Kyllä</RadioButton>
- <RadioButton GroupName="NewsLetter">En</RadioButton>
- <TextBlock>Valitse kieli:</TextBlock>
- <RadioButton GroupName="AppLanguage">Suomi</RadioButton>
- <RadioButton GroupName="AppLanguage">Svenska</RadioButton>
- <RadioButton GroupName="AppLanguage">English</RadioButton>
- <Rectangle HorizontalAlignment="Left"
- Width="200"
- Height="200"
- Fill="MediumOrchid">
- </Rectangle>
- <Image Source="Assets/citynight.jpg" Width="600" RenderTransformOrigin="0.5,0.5">
- <Image.RenderTransform>
- <CompositeTransform Rotation="217.228"/>
- </Image.RenderTransform>
- </Image>
- </StackPanel>
- </Page>
- -----------------------------------------
- <ComboBox Margin="20" Width="200">
- <ComboBoxItem>Banaani</ComboBoxItem>
- <ComboBoxItem>Omena</ComboBoxItem>
- <ComboBoxItem>Mansikka</ComboBoxItem>
- <ComboBoxItem>Hunajavesimeloni</ComboBoxItem>
- </ComboBox>
- <TextBlock Name="ComboTarget" Margin="20">Mitään ei ole vielä valittu</TextBlock>
- ----------------------------
- <Border Margin="20" Background="DarkBlue" Width="400" Height="200" HorizontalAlignment="Left">
- <TextBlock FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White">Tässä on jotain tekstiä</TextBlock>
- </Border>
- ---------------------------
- <RelativePanel Margin="10">
- <TextBlock Margin="20" Name="FirstText" FontWeight="Bold" FontSize="30">Ensimmäinen teksti</TextBlock>
- <Button Margin="20" RelativePanel.RightOf="FirstText" Name="SecondButton">Testinappi</Button>
- <Button Margin="20" RelativePanel.Below="SecondButton" RelativePanel.AlignLeftWith="SecondButton" Name="ThirdButton">Kolmas nappi</Button>
- </RelativePanel>
- --------------------------------
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Rectangle Grid.Row="0" Grid.Column="0" Fill="DarkMagenta"></Rectangle>
- <Rectangle Grid.Row="0" Grid.Column="1" Fill="LawnGreen"></Rectangle>
- <Rectangle Grid.Row="1" Grid.Column="0" Fill="LightPink"></Rectangle>
- <Rectangle Grid.Row="1" Grid.Column="1" Fill="Teal"></Rectangle>
- </Grid>
- -------------------------------
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="200" />
- <ColumnDefinition Width="300"/>
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="150"/>
- <RowDefinition />
- </Grid.RowDefinitions>
- <Rectangle Grid.Row="0" Grid.Column="0" Fill="DarkMagenta"></Rectangle>
- <Rectangle Grid.Row="0" Grid.Column="1" Fill="LawnGreen"></Rectangle>
- <Rectangle Grid.Row="0" Grid.Column="2" Fill="DarkRed"></Rectangle>
- <Rectangle Grid.Row="1" Grid.Column="0" Fill="LightPink"></Rectangle>
- <Rectangle Grid.Row="1" Grid.Column="1" Fill="Teal"></Rectangle>
- <Rectangle Grid.Row="1" Grid.Column="2" Fill="MediumSpringGreen"></Rectangle>
- </Grid>
- ----------------------------
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="240"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="200"/>
- <RowDefinition />
- </Grid.RowDefinitions>
- <!-- Ensimmäinen rivi + sarake, yhdistää kaksi saraketta yhdeksi (column span) -->
- <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Background="BurlyWood">
- <TextBlock Padding="30" FontSize="60" FontWeight="Bold">YRITYS OY AB</TextBlock>
- </StackPanel>
- <!-- varsinainen sisältö -->
- <RelativePanel Grid.Row="1" Grid.Column="0" Background="Gainsboro">
- <Button Name="FirstButton" Margin="30">Tee uusi lomake</Button>
- <Button RelativePanel.Below="FirstButton" Margin="30">Selaa vanhoja lomakkeita</Button>
- </RelativePanel>
- <!-- oikeanpuoleinen apuvalikko -->
- <StackPanel Grid.Row="1" Grid.Column="1" Background="LightSteelBlue">
- <ComboBox Margin="30" HorizontalAlignment="Center">
- <ComboBoxItem>Rovaniemi</ComboBoxItem>
- <ComboBoxItem>Tornio</ComboBoxItem>
- <ComboBoxItem>Oulu</ComboBoxItem>
- </ComboBox>
- </StackPanel>
- </Grid>
- -----------------------------------------
- <Border Margin="20"
- Width="200" Height="200"
- Background="MediumPurple"
- PointerEntered="Border_PointerEntered"
- PointerExited="Border_PointerExited">
- <TextBlock FontSize="20" HorizontalAlignment="Center" Name="MouseText">
- Laita hiiri päälle
- </TextBlock>
- </Border>
- ------------------------------
- C#:
- // navigointi toiseen Pageen, esim. MainPagessa
- private void Button_Click_1(object sender, RoutedEventArgs e)
- {
- this.Frame.Navigate(typeof(SecondPage));
- }
- -----------------
- private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- // muutetaan sender ComboBoxiksi, eli mistä comboboxista muutospyyntö tuli
- ComboBox cb = sender as ComboBox;
- // haetaan valittu asia comboboxista ja muutetaan se comboboxitemiksi
- ComboBoxItem item = cb.SelectedItem as ComboBoxItem;
- // haetaan valinnan teksti comboboxitemiksi
- String txt = item.Content as String;
- ComboTarget.Text = txt;
- }
- -----------------------
- private void Border_PointerEntered(object sender, PointerRoutedEventArgs e)
- {
- MouseText.Text = "Hiiri on päällä!";
- }
- private void Border_PointerExited(object sender, PointerRoutedEventArgs e)
- {
- MouseText.Text = "Hiiri poistui...";
- }
Add Comment
Please, Sign In to add comment