将滑块的缩略图模板编辑为图像 Windows Phone 7
所以我一直在通过谷歌从所有主要来源(例如windowsphonegeek、msdn等)查找很多“自定义滑块”。但由于某种原因,我似乎无法弄清楚如何使滑块的拇指成为图像(例如 png)。
这是问题所在的一点 xaml
<Control.Template Name="ThumbTemplate1" TargetType="Thumb">
<Image Source="myImage.png" Height="48" Width="48" />
</Control.Template>
目前不会显示任何拇指,因为它没有正确加载图像。
So I've been looking up a lot of "custom sliders" through google from all the major sources such as windowsphonegeek, msdn etc. But for some reason I can't seem to figure out how to make the thumb of the slider an image (a png for example).
Here is a little bit of xaml where the problem lies
<Control.Template Name="ThumbTemplate1" TargetType="Thumb">
<Image Source="myImage.png" Height="48" Width="48" />
</Control.Template>
At the moment this will not show any thumb since it isn't loading the image properly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想要图像的绑定,那么以这种方式设置填充椭圆/矩形等很重要,因为绑定图像画笔非常有问题,这可以解决一些麻烦
Its important to set the fill the ellipse/rectangle etc this way if you want the binding for the image since binding image brushes is very problematic, this take care of some of the hassle
您是否检查了图像的路径(通过在模板之外显示它)?
确保图像文件的构建操作为“内容”(默认为“资源”),并确保名称以“/”开头。
Have you checked the path to the image (by diplaying it outside your template)?
Ensure the image file has a build action of "Content" (the default is "Resource") and ensure you start the name with a "/".