Vanhoja harjoitustöitä
Tutustutaan muutamaan vanhaan harjoitustyöhön.
Luentotaltiointi
Ongelmia videon katselussa?Demo 6
Tehtävä 1
<Window x:Class="teht1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <Style TargetType="Button" x:Key="pieni"> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="FontFamily" Value="Arial"/> <Setter Property="FontSize" Value="15"/> <Setter Property="Margin" Value="5"/> </Style> <Style TargetType="Button" x:Key="suuri"> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="FontFamily" Value="Times New Roman"/> <Setter Property="FontSize" Value="20"/> <Setter Property="Margin" Value="5"/> </Style> <Style TargetType="Button" x:Key="suurempi"> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="FontFamily" Value="Comic Sans MS"/> <Setter Property="FontSize" Value="25"/> <Setter Property="Margin" Value="5"/> </Style> <Style TargetType="Button" x:Key="suurin"> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="FontFamily" Value="Courier New"/> <Setter Property="FontSize" Value="30"/> <Setter Property="Margin" Value="5"/> </Style> </Window.Resources> <Grid> <DockPanel Height="Auto" HorizontalAlignment="Stretch" Name="wrapPanel1" VerticalAlignment="Stretch" Width="Auto" > <StackPanel Height="auto" Width="auto" HorizontalAlignment="Left" VerticalAlignment="Center"> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Pieni" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Pieni" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Pieni" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Pieni" Width="auto" Height="auto" /> </StackPanel> <StackPanel DockPanel.Dock="Right" Orientation="Vertical" Height="auto" Width="auto" VerticalAlignment="Center" Opacity="1"> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suuri" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suuri" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suuri" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suuri" Width="auto" Height="auto" /> </StackPanel> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Height="auto" Width="auto" VerticalAlignment="Top" HorizontalAlignment="Center" Panel.ZIndex="1"> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suurempi" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suurempi" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suurempi" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suurempi" Width="auto" Height="auto" /> </StackPanel> <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Height="auto" HorizontalAlignment="Center" VerticalAlignment="Bottom" Panel.ZIndex="1" ClipToBounds="False"> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suurin" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suurin" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suurin" Width="auto" Height="auto" /> <Button Style="{Binding ElementName=Tyylit, Path=SelectedItem.Tag}" Content="Suurin" Width="auto" Height="auto" /> </StackPanel> </DockPanel> <ComboBox Name="Tyylit" VerticalAlignment="Top" HorizontalAlignment="Left"> <ComboBoxItem Tag="{StaticResource pieni}">Pieni</ComboBoxItem> <ComboBoxItem Tag="{StaticResource suuri}">Suuri</ComboBoxItem> <ComboBoxItem Tag="{StaticResource suurempi}">Suurempi</ComboBoxItem> <ComboBoxItem Tag="{StaticResource suurin}">Suurin</ComboBoxItem> </ComboBox> </Grid> </Window>
Käyttäjien kommentit