WP7中的地图模式按钮
我正在尝试制作一个 ApplicationBarMenuItem,当单击它时,会在 RoadMode 和 AerialMode 之间切换我的 bing 地图。我的伪代码看起来像这样:
private void changeMap_Click(object sender, EventArgs e)
{
if(map1.Mode == RoadMode)
map1.Mode = new Microsoft.Phone.Controls.Maps.AerialMode();
else
map1.Mode = new Microsoft.Phone.Controls.Maps.RoadMode();
}
但是,它说我不能使用 RoadMode,它是一种“类型”,就像变量一样。有人有办法解决这个问题吗?
I'm trying to make an ApplicationBarMenuItem that, when clicked, switches my bing map between RoadMode and AerialMode. my pseudocode looks something like this:
private void changeMap_Click(object sender, EventArgs e)
{
if(map1.Mode == RoadMode)
map1.Mode = new Microsoft.Phone.Controls.Maps.AerialMode();
else
map1.Mode = new Microsoft.Phone.Controls.Maps.RoadMode();
}
However, it says I cannot use RoadMode, which is a 'type', like a variable. Does anyone have a way around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为 RoadMode 是一个类,并且您试图将类与对象进行比较。
尝试(编辑)
Because RoadMode is a class and you are trying to compare class to an object.
Try (edit)