Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15.  
  16. namespace PrimerProyectoCSharp
  17. {
  18.     /// <summary>
  19.     /// Lógica de interacción para MainWindow.xaml
  20.     /// </summary>
  21.     public partial class MainWindow : Window
  22.     {
  23.         public MainWindow()
  24.         {
  25.             InitializeComponent();
  26.  
  27.             Grid miGrid = new Grid();
  28.             this.Content = miGrid;
  29.  
  30.             Button miBoton = new Button();
  31.             miGrid.Children.Add(miBoton);
  32.             miBoton.Height = 90;
  33.             miBoton.Width = 150;
  34.  
  35.             setContentButton(miBoton);
  36.         }
  37.  
  38.         private void setContentButton(Button miBoton)
  39.         {
  40.             WrapPanel wp = new WrapPanel();
  41.             wp.Children.Add(new TextBlock()
  42.             {
  43.                 Text = "rojo",
  44.                 Foreground = new SolidColorBrush(Colors.Red),
  45.             });
  46.             wp.Children.Add(new TextBlock()
  47.             {
  48.                 Text = "Azul",
  49.                 Foreground = new SolidColorBrush(Colors.Blue),
  50.             });
  51.             wp.Children.Add(new TextBlock()
  52.             {
  53.                 Text = "Verde",
  54.                 Foreground = new SolidColorBrush(Colors.Green),
  55.             });
  56.             miBoton.Content = wp;
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement