"Applications targeting Silverlight version 3 can only bind to target properties of a FrameworkElement. Support for binding to any DependencyObject dependency property was added in Silverlight 4."It does not look like UserControl derives from FrameworkElement. See msdn documentation: http://msdn.microsoft.com/en-us/libr...tanceContinued
The following link shows someone with a similar problem and the workaround they used.http://betaforums.silverlight.net/fo...20/418564.aspx
<esri:Editor x:Key="MyBarriersEditor" LayerIDs="MyBarriersGraphicsLayer" Map="{Binding ElementName=MyMap}" />
Per your post, I should remove this piece of code and then use public Map Map {...}Is it right? If so, how can I define these graphicslayers? Thanks.
<local:ClosestFacilityControl x:Name="MyClosedFacility" Visibility="Collapsed" Height="240" Width="440" Canvas.Left="306" Canvas.Top="140" Map="{Binding ElementName=_Map}" />
public Map Map { get { return GetValue(MapProperty) as Map; } set { SetValue(MapProperty, value); } } public static readonly DependencyProperty MapProperty = DependencyProperty.Register("Map", typeof(Map), typeof(ClosestFacilityControl), new PropertyMetadata(OnMapPropertyChanged)); .......
<esri:Map x:Name="_Map" Background="White" Extent="-117.23,34.03,-117.16,34.08" > .... </esri:Map>
<esri:Editor x:Key="MyBarriersEditor" LayerIDs="MyBarriersGraphicsLayer" Map="{Binding ElementName=_Map}" />
<local:ClosestFacilityControl Map="{Binding ElementName=MyMap}" VerticalAlignment="Top" HorizontalAlignment="Center"/>
public Map Map { get { return GetValue(MapProperty) as Map; } set { SetValue(MapProperty, value); } } public static readonly DependencyProperty MapProperty = DependencyProperty.Register("Map", typeof(Map), typeof(ClosestFacilityControl), new PropertyMetadata(OnMapPropertyChanged)); private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ClosestFacilityControl control = d as ClosestFacilityControl; Map newMap = e.NewValue as Map; if(control!=null) { Editor editor = control.LayoutRoot.Resources["MyBarriersEditor"] as Editor; if(editor!=null) editor.Map = newMap; editor = control.LayoutRoot.Resources["MyFacilitiesEditor"] as Editor; if(editor!=null) editor.Map = newMap; editor = control.LayoutRoot.Resources["MyIncidentsEditor"] as Editor; if(editor!=null) editor.Map = newMap; control.facilitiesGraphicsLayer = newMap.Layers["MyFacilitiesGraphicsLayer"] as GraphicsLayer; control.IncidentsGraphicsLayer = newMap.Layers["MyIncidentsGraphicsLayer"] as GraphicsLayer; control.barriersGraphicsLayer = newMap.Layers["MyBarriersGraphicsLayer"] as GraphicsLayer; control.routeGraphicsLayer = newMap.Layers["MyRoutesGraphicsLayer"] as GraphicsLayer; } }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.