我正在开发window phone 7应用程序。我不熟悉window phone 7应用程序。在我的应用程序是动态创建的按钮控制&添加背景图片按钮控制如下如何拉伸图像以适合所需空间?
Button AlphabetButton = new Button();
AlphabetButton.Content = vAlphabet;
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri("button_off.png", UriKind.Relative));
//brush.Stretch = Stretch.None;
AlphabetButton.Background = brush;
AlphabetButton.BorderBrush = new SolidColorBrush(Colors.Gray);
AlphabetButton.Margin = new Thickness(-12, -27, 0, 0);
AlphabetButton.Width = 80;
AlphabetButton.Height = 80;
我可以看到背景图片的按钮控制,但它不适合通过按钮控制所占用的空间。我可以看到右边的&按钮控件底部边框上的空白区域。这是因为图像不适合按钮控制占用的空间。我应该如何在后台添加图像,以便它能够适应按钮控件所占用的空间。你能否给我提供任何可以解决上述问题的代码或链接?
Stretch.Fill,Stretch.Uniform,Stretch.UniformToFill,Stretch.None所有这些不工作 – 2011-02-08 11:56:07