Mik*_*icz 4 silverlight f# button
我有一个按钮,图像如下:
let btnFoo = new Button()
let imgBar = new BitmapImage(new System.Uri("images/whatever.png", System.UriKind.RelativeOrAbsolute))
Run Code Online (Sandbox Code Playgroud)
我希望按钮内容包含一些文本,以及图像.
我可以很好地完成这两件事中的任何一件,但是他们同时没有把我的文字和图片都拿到按钮上:
btnFoo.Content <- "Text"
btnFoo.Content <- imgBar
Run Code Online (Sandbox Code Playgroud)
这些都不起作用:
btnFoo.Content <- "Text " + imgBar // compiler hates this
btnFoo.Content <- "Text ", imgBar // compiler is OK, but result is ugly since the image is rendered as the class text
Run Code Online (Sandbox Code Playgroud)
我也无法将按钮的背景设置为图像:
btnFoo.Background <- imgBar // compiler doesn't like this because Background expects a Media.Brush
Run Code Online (Sandbox Code Playgroud)
有什么想法/想法吗?谢谢!