如何动态地添加单选按钮,并在地图控件的按钮点击中显示它们(windows phone 8.1)
本文关键字:显示 按钮 windows phone 地图 动态 何动态 添加 单选按钮 控件 | 更新日期: 2023-09-27 18:18:55
在我的地图控件中有多个带有按钮的位置。当我点击那个位置的特定按钮时两个单选按钮应该会显示在地图控件中。
BasicGeoposition bgp = new BasicGeoposition();
AppBarButton rd = new AppBarButton();
bgp.Latitude = loct.lat;
bgp.Longitude = loct.lng;
Geopoint hwPoint = new Geopoint(bgp);
MapControl.SetLocation(rd, hwPoint);
MapControl.SetNormalizedAnchorPoint(rd, new Point(0.5, 0.5));
map1.Children.Add(rd);
通过这种方式,我在地图控件中添加了按钮。在rd_click中我应该如何实现在那个位置显示单选按钮
void rd_Click(object sender, RoutedEventArgs e)
{
RadioButton rb = new RadioButton();
RadioButton rb1 = new RadioButton();
StackPanel st = new StackPanel();
st.Children.Add(rb);
st.Children.Add(rb1);
// I want to add this stackpanel to the mapcontrol
}
在按钮附近,两个单选按钮应该显示在地图控件中。请帮帮我
错误显示在链接
首先你需要设置你的StackPanel的位置,然后添加它作为一个子地图,像这样:
MapControl.SetLocation(st, new Geopoint(/* Your location info */));
MyMap.Children.Add(st);