Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ScrollViewer>
- <StackPanel x:Name="ShopList"/>
- </ScrollViewer>
- <Button
- x:Name="FoodAdd"
- Content="Добавить"
- Margin="287,102,0,17"
- Height="81"
- Width="130"
- BorderBrush="#FFFBEFEF"
- Foreground="#FFFFF7F7"
- Background="#FF56E0C7"
- FontFamily="/Assets/Fonts/Stolzl.otf#Stolzl Light"
- Click="NewItem"/>
- private void NewItem(object sender, RoutedEventArgs e)
- {
- string item_name = NewFood.Text;
- if(item_name.Trim(' ') != "")
- {
- Button new_button = new Button();
- new_button.Content = item_name;
- new_button.Width = 350;
- new_button.HorizontalContentAlignment = HorizontalAlignment.Left;
- new_button.FontSize = 30;
- Thickness thick = new Thickness(0);
- thick.Bottom = 1;
- new_button.BorderThickness = thick;
- new_button.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x4F, 0x4E, 0x4E));
- new_button.Click += Delete_fromlist;
- ShopList.Children.Add(new_button);
- }
- NewFood.Text = "";
- NewFood.Focus(FocusState.Keyboard);
- }
- private void Delete_fromlist(object sender, RoutedEventArgs e)
- {
- ((Button)sender).Content = "";
- ShopList.Children.Remove(((Button)sender));
- }
Add Comment
Please, Sign In to add comment