Click here to Skip to main content
16,021,181 members

Comments by rohu123 (Top 4 by date)

rohu123 27-Jan-16 1:07am View    
Hi Richard,

My Xaml Page consist of only the Map Control and command bar. The XAML is as given below -

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MapTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps"
x:Class="MapTest.MainPage"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.BottomAppBar>
<commandbar>
<appbarbutton icon="Accept" label="appbarbutton">
<appbarbutton icon="Cancel" label="appbarbutton">

</Page.BottomAppBar>
<grid removed="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Maps:MapControl
x:Name="MapWorkArea"
HorizontalAlignment="Left"
Margin="10,10,0,0"
VerticalAlignment="Top"
Height="560" Width="380"
MapServiceToken="My Service Token"/>

</Page>


Code Behind as given below -

<pre>
namespace MapTest
{
///
/// An empty page that can be used on its own or navigated to within a Frame.
///

public sealed partial class MainPage : Page
{
public MainPage()
{
//intialization of the control is happening here
this.InitializeComponent();
LoadData();
}

private async void LoadData()
{
try
{
var geopoint = new Geopoint(new BasicGeoposition() { Latitude = 55.6127809826285, Longitude = 13.0031764693558 });
var youPin = CreatePin();
MapWorkArea.Children.Add(youPin);
MapControl.SetLocation(youPin, geopoint);
MapControl.SetNormalizedAnchorPoint(youPin, new Point(0.0, 1.0));
await MapWorkArea.TrySetViewAsync(geopoint, 15, 0, 0, MapAnimationKind.Bow);
}
catch (Exception ex)
{
throw;
}
}

private DependencyObject CreatePin()
{
//Creating a Grid element.
var myGrid = new Grid();
myGrid.RowDefinitions.Add(new RowDefinition());
myGrid.RowDefinitions.Add(new RowDefinition());
myGrid.Background = new SolidColorBrush(Colors.Transparent);

//Creating a Rectangle
var myRectangle = new Rectangle { Fill = new SolidColorBrush(Colors.Black), Height = 20, Width = 20 };
myRectangle.SetValue(Grid.RowProperty, 0);
myRectangle.SetValue(Grid.ColumnProperty, 0);

//Adding the Rectangle to the Grid
myGrid.Children.Add(myRectangle);

//Creating a Polygon
var myPolygon = new Polygon()
{
Points = new PointCollection() { new Point(2, 0), new Point(22, 0), new Point(2, 40) },
Stroke = new SolidColorBrush(Colors.Black),
Fill = new SolidColorBrush(Colors.Black)
};
myPolygon.SetValue(Grid.RowProperty, 1);
myPolygon.SetValue(Grid.ColumnProperty, 0);

//Adding the Polygon to the Grid
myGrid.Children.Add(myPolygon);
return myGrid;
}
}
}

</pre>
rohu123 13-Jan-16 5:47am View    
Deleted
Hi all,

I got the solution for this issue.

But facing another issue is that When i using DrawerNavigation Control on the parent page it not generating events on the parent page.

For Example -

On Menu1.xaml added reference of user control like given below -
xmlns:uc ="using:Sample.Controls"

Add using user control as given -

<uc:drawernavigation x:name="ucDNMenu1" zindex="999"></uc:drawernavigation>


Thanks in advance,
Rohan
rohu123 2-Mar-11 4:02am View    
Thanks.
rohu123 2-Mar-11 4:01am View    
Thanks dude..