MapView: change position and size

64
2
a week ago
Highlighted
New Contributor III

Hi all,
I'am developing an iOS app with Visual Studio Xamarin, using ArcGIS runtime sdk .NET.
When the application starts the map occupies the entire display. I want the map to be
displayed starting at some distance from the top edge of the display.
How can this be done programmatically.

Many thanks

Best regards

Massimo

Tags (3)
Reply
0 Kudos
2 Replies
Highlighted
MVP Regular Contributor

You would need to do in the Xaml for the view containing the MapView.  This could be done a number of ways.

My preferred method is to setup a Grid and put the MapView where I want it.  But I believe just adding a Margin to the view would suffice.

Grid:

 

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
			 ...
             Title="{Binding Title}">

    <Grid  WidthRequest="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

		<!-- Could setup Rows to set away from top -->
        <Grid x:Name="MainGrid" Grid.Column="1" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid>
                <esri:MapView />
            </Grid>
        </Grid>
    </Grid>
</ContentPage>

 

 

Margin:

 

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
			 ...
             Title="{Binding Title}">
	
	<-- Margin="Left, Top, Right, Bottom"
	<esri:MapView Margin="20,20,0,0"/>

</ContentPage>

 

 

Reply
0 Kudos
Highlighted
New Contributor III

Joe, many thanks for your reply.

Your solution is interesting, but I don't work with Xamarin Forms. In Xamarin iOS the layout can be built in the Main.storyboard file, but in the latest versions of Visual Studio it is indicated that the iOS Designer will be removed soon and Xcode is the best solution for designing iOS apps. I don't work with Xcode and for this reason I am looking for a solution in C# code.

 

Best regards

 

Massimo

Reply
0 Kudos