开发者

map mode button in WP7

开发者 https://www.devze.com 2023-03-15 01:19 出处:网络
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:

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

精彩评论

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

关注公众号