Advertisement
Tosker

Vending Machine Tutorial - Final MainWindow.Xaml

Dec 1st, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 4.35 KB | None | 0 0
  1.     <!-- Start of window content -->
  2. <!-- Content from toskerscorner.wordpress.com -->
  3. <Grid Background="LightBlue">
  4.         <Grid.ColumnDefinitions>
  5.             <ColumnDefinition/>
  6.             <ColumnDefinition/>
  7.             <ColumnDefinition/>
  8.             <ColumnDefinition/>
  9.             <ColumnDefinition/>
  10.         </Grid.ColumnDefinitions>
  11.         <Grid.RowDefinitions>
  12.             <RowDefinition/>
  13.             <RowDefinition/>
  14.             <RowDefinition/>
  15.             <RowDefinition/>
  16.             <RowDefinition/>
  17.             <RowDefinition/>
  18.             <RowDefinition/>
  19.         </Grid.RowDefinitions>
  20.  
  21.         <StackPanel Background="Coral" Grid.ColumnSpan="5">
  22.             <TextBlock Style="{StaticResource TitleBlock}">Toskers Vending</TextBlock>
  23.         </StackPanel>
  24.  
  25.         <ListView Style="{StaticResource VendingList}" ItemsSource="{Binding Items}" Grid.Row="1" Grid.ColumnSpan="3" Grid.RowSpan="4">
  26.             <ListView.ItemTemplate>
  27.                 <DataTemplate>
  28.                     <DockPanel>
  29.                         <Button DataContext="{Binding}" Style="{StaticResource VendingButton}" DockPanel.Dock="Left" Click="Purchase_Clicked">
  30.                             Purchase
  31.                         </Button>
  32.                         <StackPanel DockPanel.Dock="Right">
  33.                             <TextBlock Style="{StaticResource CustomerLabel}" Text="{Binding Information.Name}"/>
  34.                             <TextBlock Style="{StaticResource CustomerLabel}" Text="{Binding Information.Price, StringFormat=${0:0.00}}"/>
  35.                             <TextBlock Foreground="Red" Text="Out of stock!" Visibility="{Binding OutOfStockMessage}"/>
  36.                         </StackPanel>
  37.                     </DockPanel>
  38.                 </DataTemplate>
  39.             </ListView.ItemTemplate>
  40.         </ListView>
  41.  
  42.         <Button Style="{StaticResource MoneyButton}" Grid.Row="5" Click="Insert25_Clicked">
  43.             $0.25
  44.         </Button>
  45.         <Button Style="{StaticResource MoneyButton}" Grid.Row="5" Grid.Column="1" Click="Insert50_Clicked">
  46.             $0.50
  47.         </Button>
  48.         <Button Style="{StaticResource MoneyButton}" Grid.Row="5" Grid.Column="2" Click="Insert75_Clicked">
  49.             $0.75
  50.         </Button>
  51.  
  52.         <StackPanel Grid.Row="6" Grid.ColumnSpan="3">
  53.             <TextBlock Style="{StaticResource CustomerLabel}" Text="{Binding Bank.Inserted,  StringFormat=Inserted ${0:0.00}}" />
  54.             <TextBlock Style="{StaticResource CustomerLabel}" Text="{Binding Bank.Change,  StringFormat=Change ${0:0.00}}" />
  55.         </StackPanel>
  56.  
  57.         <DockPanel Margin="5" Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2" Grid.RowSpan="3" Background="BlanchedAlmond">
  58.             <TextBlock DockPanel.Dock="Bottom" Style="{StaticResource CustomerLabel}" Text="{Binding Bank.BankTotal, StringFormat=Earnings ${0:0.00}}"/>
  59.             <TextBlock DockPanel.Dock="Top" FontSize="28" Style="{StaticResource CustomerLabel}" HorizontalAlignment="Center">Inventory</TextBlock>
  60.             <StackPanel DockPanel.Dock="Bottom">
  61.                 <TextBlock Margin="5" Style="{StaticResource CustomerLabel}" FontSize="16" Text="{Binding Items[0].InventoryDisplay}" />
  62.                 <TextBlock Margin="5" Style="{StaticResource CustomerLabel}" FontSize="16" Text="{Binding Items[1].InventoryDisplay}" />
  63.                 <TextBlock Margin="5" Style="{StaticResource CustomerLabel}" FontSize="16" Text="{Binding Items[2].InventoryDisplay}" />
  64.                 <TextBlock Margin="5" Style="{StaticResource CustomerLabel}" FontSize="16" Text="{Binding Items[3].InventoryDisplay}" />
  65.             </StackPanel>
  66.         </DockPanel>
  67.  
  68.         <StackPanel Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="2" Grid.RowSpan="3" Background="DarkKhaki">
  69.             <TextBlock DockPanel.Dock="Top" FontSize="28" Style="{StaticResource CustomerLabel}" HorizontalAlignment="Center">Manager</TextBlock>
  70.             <Button Style="{StaticResource ManagerButton}" Click="Refill_Clicked">
  71.                 Refill Supply
  72.             </Button>
  73.             <Button Style="{StaticResource ManagerButton}" Click="Empty_Clicked">
  74.                 Empty Supply
  75.             </Button>
  76.             <Button Style="{StaticResource ManagerButton}" Click="Withdraw_Clicked">
  77.                 Withdraw Payment
  78.             </Button>
  79.         </StackPanel>
  80.     </Grid>
  81.     <!-- End of window content -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement