如何在地图控件中动态添加单选按钮并在单击按钮时显示它们(windows phone 8.1)
How to add radio buttons dynamically and display them in a button click in map control(windows phone 8.1)
在我的地图控件中有多个带有按钮的位置。因此,当我单击该位置的那个特定按钮时,地图控件中应显示两个单选按钮。
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
}
地图控件中应在按钮附近显示两个单选按钮。请帮助我
错误显示在 link
首先,您需要设置 StackPanel 的位置,然后将其添加为地图的子项,如下所示:
MapControl.SetLocation(st, new Geopoint(/* Your location info */));
MyMap.Children.Add(st);
在我的地图控件中有多个带有按钮的位置。因此,当我单击该位置的那个特定按钮时,地图控件中应显示两个单选按钮。
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
}
地图控件中应在按钮附近显示两个单选按钮。请帮助我
错误显示在 link
首先,您需要设置 StackPanel 的位置,然后将其添加为地图的子项,如下所示:
MapControl.SetLocation(st, new Geopoint(/* Your location info */));
MyMap.Children.Add(st);