Original Post
A much-discussed topic online, one method I found was to use negative numbers for padding to effectively erase the border region. With an image of 50x50 where every pixel must show up exactly (1:1), a way I've found to create a flat button using that image, shown exactly 50x50, is:
BitmapImage bitmap = new BitmapImage( new Uri("BtnImage.png", System.UriKind.Relative) );
Image image = new Image( );
image.Source = bitmap;
Button button = new Button( );
button.Width = 50;
button.Height = 50;
button.Background = Brushes.Transparent;
button.BorderBrush = Brushes.Transparent;
button.HorizontalContentAlignment = HorizontalAlignment.Stretch;
button.Padding = new Thickness(-3);
button.Content = image;
It so happens that a padding of -3 exactly erases the border region and results in a 50x50 image button. My question is, is this reliable or would it appear broken on some people's machines for whatever reason? It sure seems like a hack to me.