开发者

map mode button in WP7

I'm trying to make an Appli开发者_JAVA技巧cationBarMenuItem 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?


Because RoadMode is a class and you are trying to compare class to an object.

Try (edit)

if(map1.Mode is RoadMode)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜