Commit dabfd35d authored by islater's avatar islater
Browse files

asdf

parent 173eb8d5
......@@ -18,7 +18,7 @@
<Border BorderThickness="1" BorderBrush="Black" Margin="10,38,10,60">
<ListBox Name="ticket" HorizontalContentAlignment="Stretch" ItemsSource="{Binding Path=Items}" Margin="0,0,-1,-1">
<ListBox.ItemTemplate>
<DataTemplate>
<DataTemplate >
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
......@@ -29,15 +29,16 @@
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBlock Name="ItemName" Text="{Binding}"></TextBlock>
<TextBlock PreviewMouseDown="ItemName_PreviewMouseDown" Name="ItemName" Text="{Binding}"></TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Left" Text="{Binding Path=Price, StringFormat=c}"/>
<Button DataContext="{Binding}" Grid.Column="2" Click="RemoveItemClicked" Name="RemoveListItem" Content="X" Background="Red" Width="32" Height="32"/>
<ListBox BorderThickness="0" Grid.Row="1" HorizontalAlignment="Center" ItemsSource="{Binding Path=SpecialInstructions}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<Button Click="RemoveItemClicked" Name="RemoveListItem" Content="Remove" Background="Red" Margin="112,548,112,2"/>
<TextBlock Name="SubtotalTextBox" HorizontalAlignment="Right" Margin="0,533,10,0" FontSize="20" Text="{Binding Path=Subtotal, StringFormat=c}" TextWrapping="Wrap" VerticalAlignment="Top" Height="31" Width="84"/>
<TextBlock HorizontalAlignment="Left" Margin="7,534,0,0" FontSize="20" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" Width="90">Subtotal</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="10,-2,0,0" Text="Ticket" FontSize="20" TextWrapping="Wrap" VerticalAlignment="Top" Width="70"/>
......
......@@ -31,19 +31,25 @@ namespace PointOfSale
}
public void RemoveItemClicked(object sender, RoutedEventArgs e)
{
ticket.SelectedItem = -1;
if (DataContext is Order order)
{
((Order)DataContext).Remove((IOrderItem)ticket.SelectedItem);
IOrderItem i = (IOrderItem)((Button)e.Source).DataContext;
((Order)DataContext).Remove((IOrderItem)i);
}
}
private void ItemName_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
IOrderItem i = (IOrderItem)((TextBlock)e.Source).DataContext;
var a = this.Parent;
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment