/// <summary>
 /// Creates a MapSearchRequest with the specified map item.
 /// </summary>
 public MapSearchRequest( MapItem item )
 {
     Item = item;
 }
        private void SetMapFloor( MapItem[] items )
        {
            if ( items == null || items.Length == 0 )
            {
                return;
            }

            _vm.Properties.Floor = ( from i in items group i by i.Floor ?? 0 into g orderby g.Count() descending select g.Key ).First();
            SetItemsVisibility( _vm.Properties.Floor );
        }
        private void SetMapItems( MapItem[] items )
        {
            foreach ( var item in _map.Children.OfType<ContentControl>().ToArray() )
            {
                _map.Children.Remove( item );
            }

            if ( items == null )
            {
                return;
            }

            foreach ( var item in items )
            {
                var point = new Geopoint( new BasicGeoposition { Latitude = item.Latitude, Longitude = item.Longitude } );
                var control = new ContentControl
                {
                    ContentTemplate = ItemTemplate,
                    Content = item.Name,
                    Tag = item.Floor ?? 0
                };
                MapControl.SetLocation( control, point );
                MapControl.SetNormalizedAnchorPoint( control, new Point( ItemAnchorX, ItemAnchorY ) );
                _map.Children.Add( control );
            }
        }
        private async void SetMapView( MapItem[] items )
        {
            if ( items == null || items.Length == 0 )
            {
                return;
            }

            var positions = items.Select( i => new BasicGeoposition { Latitude = i.Latitude, Longitude = i.Longitude } );
            var box = GeoboundingBox.TryCompute( positions );
            var margin = new Thickness( 30.0 );
            await _map.TrySetViewBoundsAsync( box, margin, MapAnimationKind.Default );
        }
 private void OnItemsChanged( MapItem[] items )
 {
     SetMapItems( items );
     SetMapView( items );
     SetMapFloor( items );
 }