<esri:OverviewMap x:Name="MyOverviewMap" Map="{Binding ElementName=MyMap}">
I have created a WPF Window. If I place the OverviewMap Control in the new window and load the application it freezes at the place where you set the Layer property. If I pull the overview map out of the new window and place it on the form with the map it works perfectly. Is this an known error and is there a work around?
I'm not sure I know how to replicate the issue so you have two different windows, one with your map and one with OverviewMap? How does OverviewMap set its Map property?
I suspect the problem here is with
<esri:OverviewMap x:Name="MyOverviewMap" Map="{Binding ElementName=MyMap}">
Element binding will not work if MyMap exists in a different window. For the window that will hold OverviewMap control, you may need to create a Map DependencyProperty for the OverviewMap control to use.
public Map Map { get { return (Map)GetValue(MapProperty); } set { SetValue(MapProperty, value); } } public static readonly DependencyProperty MapProperty = DependencyProperty.Register("Map", typeof(Map), typeof(OtherWindow), new PropertyMetadata(OnMapPropertyChanged)); private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OtherWindow ow = d as OtherWindow; if (ow != null && e.NewValue is Map) ow.MyOverviewMap.Map = e.NewValue as Map; } public Layer Layer { get { return (Layer)GetValue(LayerProperty); } set { SetValue(LayerProperty, value); } } public static readonly DependencyProperty LayerProperty = DependencyProperty.Register("Layer", typeof(Layer), typeof(OtherWindow), new PropertyMetadata(OnLayerPropertyChanged)); private static void OnLayerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OtherWindow ow = d as OtherWindow; if (ow != null && e.NewValue is Layer) ow.MyOverviewMap.Layer = e.NewValue as Layer; }
private void Window_Loaded(object sender, RoutedEventArgs e) { OtherWindow ow = new OtherWindow() { Map = this.MyMap, Layer = new ArcGISTiledMapServiceLayer() { Url = (this.MyMap.Layers[0] as ArcGISTiledMapServiceLayer).Url } }; ow.Show();
Map and Layer property in your code use DependencyProperty that sets Map and Layer of the OverviewMap contro? (similar to code below)
I do not get error when I have the following code in OtherWindow.xaml.cspublic Map Map { get { return (Map)GetValue(MapProperty); } set { SetValue(MapProperty, value); } } public static readonly DependencyProperty MapProperty = DependencyProperty.Register("Map", typeof(Map), typeof(OtherWindow), new PropertyMetadata(OnMapPropertyChanged)); private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OtherWindow ow = d as OtherWindow; if (ow != null && e.NewValue is Map) ow.MyOverviewMap.Map = e.NewValue as Map; } public Layer Layer { get { return (Layer)GetValue(LayerProperty); } set { SetValue(LayerProperty, value); } } public static readonly DependencyProperty LayerProperty = DependencyProperty.Register("Layer", typeof(Layer), typeof(OtherWindow), new PropertyMetadata(OnLayerPropertyChanged)); private static void OnLayerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OtherWindow ow = d as OtherWindow; if (ow != null && e.NewValue is Layer) ow.MyOverviewMap.Layer = e.NewValue as Layer; }
In MainWindow.xaml.csprivate void Window_Loaded(object sender, RoutedEventArgs e) { OtherWindow ow = new OtherWindow() { Map = this.MyMap, Layer = new ArcGISTiledMapServiceLayer() { Url = (this.MyMap.Layers[0] as ArcGISTiledMapServiceLayer).Url } }; ow.Show();
public static readonly DependencyProperty MapProperty = DependencyProperty.Register("Map", typeof(Map), typeof( OtherWindow), new PropertyMetadata(OnMapPropertyChanged));
public static readonly DependencyProperty LayerProperty = DependencyProperty.Register("Layer", typeof(Layer), typeof( OtherWindow), new PropertyMetadata(OnLayerPropertyChanged));
Can you try to run Fiddler with your application to monitor web requests?
I really could not replicate the issue you are facing with OverviewMap. I modified a copy of this sample in WPF http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#OverviewMap.
. Placing OverviewMap code in another Window with the code I included in my last post.
Did you replace "OtherWindow" with your own class name?
If that still does not work for you, download Toolkit source code from CodePlex http://esrisilverlight.codeplex.com/ and debug through it.