我遇到了一個我完全無能爲力的問題。我收到以下錯誤消息:Gerneral Transform InvalidOperation異常未被用戶代碼處理
指定的Visual和Visual不共享一個共同的祖先,所以兩個視覺之間沒有有效的轉換。
當用戶點擊地圖上的某個點時會調用這個函數。任何幫助,將不勝感激。我附上了錯誤的片段。如果您需要更多代碼示例,請告訴我。
這是我的相關XAML:
(<)INF:DialogWindowBase X:類= 「Alliance.CommonUI.Views.Maps.EsriMapView」
<Grid>
<Grid>
<DataTemplate x:Key="MyFeatureLayerInfoWindowTemplate">
<TextBlock Text="Content" Foreground="White" FontSize="12" />
</DataTemplate>
<esri:SimpleRenderer x:Key="MySimpleRenderer">
<esri:SimpleRenderer.Symbol>
<esri:SimpleFillSymbol Fill="#01FFFFFF" BorderBrush="#88000000" BorderThickness="2" />
</esri:SimpleRenderer.Symbol>
</esri:SimpleRenderer>
</Grid.Resources>
<esri:Map x:Name="MyMap" Background="#FFE3E3E3" WrapAround="True" MouseClick="MyMap_MouseClick" MouseRightButtonDown="MyMap_MouseRightButtonDown" Extent="-9834972.92753924,4441899.425293319,-9833977.88119163, 4442762.485358352">
<esri:ArcGISTiledMapServiceLayer ID="MyLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
<!--<esri:ArcGISLocalDynamicMapServiceLayer ID="Calvert_City" Path="C:\Users\jessical\Documents\ArcGIS\CalvertCity_Test.mpk"/>-->
<esri:ArcGISDynamicMapServiceLayer ID="Calvert_City" Url="http://localhost:6080/arcgis/rest/services/CalvertCity_Test_2/MapServer"/>
<esri:FeatureLayer ID="MyFeatureLayer" Url="http://localhost:6080/arcgis/rest/services/CalvertCity_Test_2/MapServer/0"
Renderer="{StaticResource MySimpleRenderer}" />
</esri:Map>
<Border Background="{StaticResource PanelGradient}" BorderThickness="1" CornerRadius="5"
HorizontalAlignment="Left" VerticalAlignment="Top"
Margin="20" Padding="5" BorderBrush="Black" >
<esri:Legend Map="{Binding ElementName=MyMap}"
LayerIDs="Calvert_City"
LayerItemsMode="Tree"
ShowOnlyVisibleLayers="False"
Refreshed="Legend_Refreshed">
<esri:Legend.MapLayerTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" >
</CheckBox>
<Slider Maximum="1" Value="{Binding Layer.Opacity, Mode=TwoWay}" Width="50" />
</StackPanel>
</DataTemplate>
</esri:Legend.MapLayerTemplate>
<esri:Legend.LayerTemplate>
<DataTemplate>
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" >
</CheckBox>
</DataTemplate>
</esri:Legend.LayerTemplate>
</esri:Legend>
</Border>
<esri:InfoWindow x:Name="MyInfoWindow"
Padding="2"
CornerRadius="20"
Background="{StaticResource PanelGradient}"
Map="{Binding ElementName=MyMap}"
ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}"
MouseLeftButtonUp="MyInfoWindow_MouseLeftButtonUp" />
發佈您的XAML請 –
XAML已張貼 – JLott