Add chapter 6 samples

This commit is contained in:
Alvin Ashcraft
2023-07-02 12:49:25 -04:00
parent 370d8a52b8
commit 7d9fe9fb0f
62 changed files with 2566 additions and 0 deletions
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="MyMediaCollection.Views.ItemDetailsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyMediaCollection.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<Style x:Key="AttributeTitleStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="AttributeValueStyle" TargetType="TextBox">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Margin" Value="8"/>
</Style>
<Style x:Key="AttributeComboxValueStyle" TargetType="ComboBox">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Margin" Value="8"/>
</Style>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Item Details" FontSize="18" Margin="8"/>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Name:" Style="{StaticResource AttributeTitleStyle}"/>
<TextBox Grid.Column="1" Style="{StaticResource AttributeValueStyle}" Text="{x:Bind ViewModel.ItemName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Media Type:" Grid.Row="1" Style="{StaticResource AttributeTitleStyle}"/>
<ComboBox Grid.Row="1" Grid.Column="1" Style="{StaticResource AttributeComboxValueStyle}" ItemsSource="{x:Bind ViewModel.ItemTypes}" SelectedValue="{x:Bind ViewModel.SelectedItemType, Mode=TwoWay}"/>
<TextBlock Text="Medium:" Grid.Row="2" Style="{StaticResource AttributeTitleStyle}"/>
<ComboBox Grid.Row="2" Grid.Column="1" Style="{StaticResource AttributeComboxValueStyle}" ItemsSource="{x:Bind ViewModel.Mediums}" SelectedValue="{x:Bind ViewModel.SelectedMedium, Mode=TwoWay}"/>
<TextBlock Text="Location:" Grid.Row="3" Style="{StaticResource AttributeTitleStyle}"/>
<ComboBox Grid.Row="3" Grid.Column="1" Style="{StaticResource AttributeComboxValueStyle}" ItemsSource="{x:Bind ViewModel.LocationTypes}" SelectedValue="{x:Bind ViewModel.SelectedLocation, Mode=TwoWay}"/>
</Grid>
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right">
<SplitButton x:Name="SaveButton"
Content="Save and Return"
Margin="8,8,0,8"
Click="{x:Bind ViewModel.SaveItemAndReturnAsync}"
IsEnabled="{x:Bind ViewModel.IsDirty, Mode=OneWay}">
<SplitButton.Flyout>
<Flyout>
<StackPanel>
<Button Content="Save and Create New"
Click="{x:Bind ViewModel.SaveItemAndContinueAsync}"
IsEnabled="{x:Bind ViewModel.IsDirty, Mode=OneWay}"
Background="Transparent"/>
<Button Content="Save and Return"
Click="{x:Bind ViewModel.SaveItemAndReturnAsync}"
IsEnabled="{x:Bind ViewModel.IsDirty, Mode=OneWay}"
Background="Transparent"/>
</StackPanel>
</Flyout>
</SplitButton.Flyout>
<SplitButton.Resources>
<TeachingTip x:Name="SavingTip"
Target="{x:Bind SaveButton}"
Title="Save and create new"
Subtitle="Use the dropdown button option to save your item and create another.">
</TeachingTip>
</SplitButton.Resources>
</SplitButton>
<Button Content="Cancel" Margin="8" Command="{x:Bind ViewModel.CancelCommand}"/>
</StackPanel>
</Grid>
</Page>