×

Discussion Board

Results 1 to 7 of 7

Hybrid View

  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    13

    Problem with Microsoft.Phone.Maps.Map when going full screen

    Hello, I have a quite weird problem. I have the following user control:
    Code:
    <UserControl x:Class="MyApplication.ucMap"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Controls="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
        mc:Ignorable="d"
        FontFamily="{StaticResource PhoneFontFamilyNormal}"
        FontSize="{StaticResource PhoneFontSizeNormal}"
        Foreground="{StaticResource PhoneForegroundBrush}"
        d:DesignHeight="480" d:DesignWidth="480">
    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
            <Grid x:Name="MapGrid" Background="{StaticResource PhoneChromeBrush}">
                <Controls:Map
                x:Name="TripMap"
                PedestrianFeaturesEnabled="True"
                LandmarksEnabled="True"
                ZoomLevel="1.4"
                IsHitTestVisible="False"
                Pitch="30"
                CartographicMode="road"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    BorderBrush="Blue"
                    BorderThickness="3"
                    >
                </Controls:Map>
                <TextBlock x:Name="mapHelpHeader" TextWrapping="Wrap" Text="Back button to exit full screen" Foreground="Black" Visibility="Collapsed" IsHitTestVisible="False" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                <Slider x:Name="sliderZoomLevel" Margin="50,0,50,0" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Maximum="20" ValueChanged="sliderZoomLevel_ValueChanged" SmallChange="1" Value="10" Minimum="1"/>
                <Slider x:Name="sliderPitchLevel" Margin="0,50,0,50" HorizontalAlignment="Left" VerticalAlignment="Stretch" Maximum="75" ValueChanged="sliderPitchLevel_ValueChanged" SmallChange="1" Value="30" Minimum="0" Orientation="Vertical"/>
            </Grid>
        </Grid>
    </UserControl>
    As you can see, it contains a map in it (with a blue border). This user control is created dynamically and added to the main page of my application. My problem is the following. When I try to remove the user control from the main page and add it on a full-screen window (with a code like bellow), I am loosing the map contents.
    Code:
                fullScreenMapDlg = new FullScreenDialog();
                fullScreenMapDlg.window.IsOpen = true;
                fullScreenMapDlg.window.WindowClosed += (s, e) =>
                {
                  // blah... blah... blah... -> Revert everything back.
                };
    
                LayoutRoot.Children.Remove(MapGrid);
                fullScreenMapDlg.questGrid.Children.Add(MapGrid);
                Grid.SetRow(MapGrid, 0);
                Grid.SetColumn(MapGrid, 0);
                mapHelpHeader.Visibility = System.Windows.Visibility.Visible;
                TripMap.IsHitTestVisible = true;
    The more weird is that I don't see the map, but I can see the 'blue' border of the map control (which probably means that the control is correctly located on the dialog). Even more weird is that if I set a MapLayer on the map control before switching to full screen, then the map is perfectly displayed fullscreen with that layer.
    Is it possible that all these happening because I am trying to run the app from the emulator? Do the Windows Phone 8 maps have any issues with running in the emulator (apart from the internet connection needed)?

    Thank you very much.

    Yours sincerely

    Efthymios Kalyviotis

  2. #2
    Registered User
    Join Date
    Jul 2011
    Posts
    20

    Re: Problem with Microsoft.Phone.Maps.Map when going full screen

    You should find another way to show it fullscreen without rebuilding the visual tree. Try hiding all other controls.
    When you remove map control from visual tree and add it to another place, something wrong happens.

  3. #3
    Registered User
    Join Date
    Apr 2013
    Posts
    13

    Re: Problem with Microsoft.Phone.Maps.Map when going full screen

    Unfortunately, I can not do it by hiding other controls. The map is on a panorama page and that page can not be hidden as you know since it will hide everything else. The only way is if I add a second map to the full-screen window and copy all the properties of the old one (even add the layers of it) which seems to be quite expensive for the system bandwidth in terms of both CPU, Memory and internet.
    This is quite weird behavior. It should work as it is (it was working with Bing maps). The most weird is that if I add a MapLayer with some items (eg a path, or a custom pushpin) before going fullscreen then the map appear correctly in fullscreen. I am wondering for 2 things:
    1) Is it possible that this problem only occurs in the emulator and not in a real WP8 device?
    2) Is it possible that I can somehow issue a command in order to force the map to repaint (refresh, reposition or whatever) itself after going fullscreen?

  4. #4
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    296

    Re: Problem with Microsoft.Phone.Maps.Map when going full screen

    Quote Originally Posted by ekalyvio View Post
    1) Is it possible that this problem only occurs in the emulator and not in a real WP8 device?
    try the remote service to test your app on real devices (remotly), https://www.developer.nokia.com/Devi...device_access/ to test on a phone.

    Quote Originally Posted by ekalyvio View Post
    2) Is it possible that I can somehow issue a command in order to force the map to repaint (refresh, reposition or whatever) itself after going fullscreen?
    There is a couple of methods you can try (I haven't tested any yet.)
    Arrange => InvalidateArrange
    Measure => InvalidateMeasure
    UpdateLayout

    hope it helps.
    Tell us if it works or not.

    Yassine,

  5. #5
    Registered User
    Join Date
    Apr 2013
    Posts
    13

    Re: Problem with Microsoft.Phone.Maps.Map when going full screen

    Thank you Loukt. I didn't know for such service with real devices. Now the results and some workaround to the problem.
    On Nokia Lumia 620 it did actually work 9 out of 10 times. The only time it didn't work at all was while the map was fetching tile data (I couldn't test other devices since they were registering wrong mouse click coordinates on the phones).
    On the simulator was problematic although. I have done some tests and I ended up in the following fix:

    I added an OpenAnimation.Ended event on my window and the following code:
    Code:
    fullScreenMapDlg.window.OpenAnimation.Ended += (s, e) =>
                {
                    Dispatcher.BeginInvoke(() => {
                        TripMap.Arrange(new Rect(0, 0, 480, 800));
                    });
                };
    That code seemed to do the trick. When I was trying to do the 'arrange' outside the event handler, nothing was happening. It seems a bit obvious since the window hadn't even started to do the transition to the open state. Actually the problem is that for some reason adding the map dynamically to the window, the window was not updating its layout and the size of it was remaining to something like (NAN, NAN). Even after 'arranging' the map, the window had the same size (obviously something is happening).

    Now, one last tiny problem is the following:
    TripMap.Arrange(new Rect(0, 0, 480, 800));

    These are hardcoded coordinates. When trying to do something like bellow, the map was not updating again correctly.
    TripMap.Arrange(new Rect(0, 0, Application.Current.Host.Content.ActualWidth, Application.Current.Host.Content.ActualHeight));

    It was trying to arrange it to (0, 0) - (480, 853) which I don't know if they are correct coordinates. Any other way to get correct device resolution sizes and ensure that the map will open fullscreen in all phone resolutions?

    Thank you very much.

    Efthymios Kalyviotis

  6. #6
    Registered User
    Join Date
    Jul 2011
    Posts
    20

    Re: Problem with Microsoft.Phone.Maps.Map when going full screen

    480, 853 are quite correct values. It's for 720p devices (1280x720 resolution). For other devices it should be 480,800.
    So it's okay

  7. #7
    Registered User
    Join Date
    Apr 2013
    Posts
    13

    Re: Problem with Microsoft.Phone.Maps.Map when going full screen

    480, 853 are quite correct values. It's for 720p devices (1280x720 resolution). For other devices it should be 480,800.
    Yes. I think you are right.

    Creating the rectangle I should reduce the size by 1 in each side. The following worked just fine:

    Code:
    TripMap.Arrange(
       new Rect(0, 0, Application.Current.Host.Content.ActualWidth-1, Application.Current.Host.Content.ActualHeight-1)
    );

Similar Threads

  1. Problem about full screen application
    By lixiaoquan in forum Symbian
    Replies: 3
    Last Post: 2010-04-23, 13:18
  2. problem related to full screen
    By deepakk in forum Symbian User Interface
    Replies: 4
    Last Post: 2008-02-29, 14:49
  3. Problem displaying full screen on 6131
    By Paradox23 in forum Streaming and Video
    Replies: 0
    Last Post: 2006-10-30, 10:46
  4. Full Screen problem
    By PankajNeve in forum Symbian
    Replies: 5
    Last Post: 2006-09-30, 16:24
  5. Full Screen Problem
    By hkzr in forum Mobile Java General
    Replies: 2
    Last Post: 2005-05-06, 15:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×