简体   繁体   中英

How to bind textbox in to a mapcontrol in windows phone 8.1

I am trying to develop a map application in windows phone 8.1. In my map there are many locations added with the mapicon. As Map icon is sealed we cannot generate a clickable event. How to add a textbox or a radiobutton in the place of map icon to handle event in order to perform some task. I referred many questions and topics.

 <Maps:MapControl x:Name="map1" MapServiceToken=""   HorizontalAlignment="Left" Margin="26,57,0,0" VerticalAlignment="Top" Height="306" Width="347">

        <Maps:MapItemsControl  x:Name="mapitem">                
            <Maps:MapItemsControl.ItemTemplate>
                <DataTemplate>
                    <TextBox Maps:MapControl.Location="{Binding }"></TextBox>
                </DataTemplate>                   
            </Maps:MapItemsControl.ItemTemplate>  
            </Maps:MapItemsControl>            
    </Maps:MapControl>

How to correctly bind this textbox to the map control. So when I click on MapIcon or an XAML control it should be displayed.

In my MapControl their are many locations with MapIcons. So when I click on mapIcon I should get a XAML control. Please suggest me some reference.

This is my code behind file trying to add XAML control

                BasicGeoposition bgp = new BasicGeoposition();

                RadioButton rd = new RadioButton();

                bgp.Latitude = loct.lat;
                bgp.Longitude = loct.lng;
                Geopoint hwPoint = new Geopoint(bgp);

                mapi.Location = hwPoint; //mapi is my mapicon

                map1.Children.Add(rd); //map1 is my mapcontrol

When I try to write (map1. ) I cannot find setlocation method

To correctly position your textbox you will need to first need to assign it a location, once that is done you can add it as a child of the map:

MapControl.SetLocation(rd, hwPoint);
MyMap.Children.Add(rd);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM