Rectangle Button


      <Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

            <Button.Content>

                <Rectangle Height="40" Width="40" Fill="Black" />

            </Button.Content>

        </Button>

           System.Windows.Controls.Button button = new System.Windows.Controls.Button();

            System.Windows.Shapes.Rectangle r = new Rectangle();

            r.Width = 40;

            r.Height = 40;

            r.Fill = System.Windows.Media.Brushes.Black;

            button.Content = r;

           this.Content = button;
 

 
原文地址:https://www.cnblogs.com/quietwalk/p/2262200.html