Example #1
0
        private void Button_fish_Click(object sender, RoutedEventArgs e)
        {
            fishy_inv.add_fish();
            DataGrid_log.Items.Add(new Fish(fishy.get_type(), fishy.get_value()));

            // Using a foreach (Fish fishy in Fish_inventory.inventory) returns type & value
        }
Example #2
0
        private void Button_fish_Click(object sender, RoutedEventArgs e)
        {
            // We only add fish to the inventory and rely in DataGrid_log.ItemsSource
            // from earlier to set it to the right value
            fishy_inv.add_fish();

            // However it only checks if the data source contains new items on first draw
            // meaning it will not update data when you don't change the tab
            // in which case we have to trigger a manual refresh
            DataGrid_log.Items.Refresh();
        }