Dim value As Double = MySlider.Value Dim l_Parcels As ArcGISDynamicMapServiceLayer = TryCast(Me.MyMap.Layers("MG_Parcels"), ArcGISDynamicMapServiceLayer) Dim l_Parcels2 As ArcGISDynamicMapServiceLayer = TryCast(Me.MyMap.Layers("MG_Streets"), ArcGISDynamicMapServiceLayer) l_Parcels.Opacity = value l_Parcels2.Opacity = 1 - value
Private Sub MultiLayerOpacityTurnOn1_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Private Sub Slider_ValueChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Double))
I can get this to work with my map service...but tryign to use ESRIs and it wont work.....
<Slider x:Name="MySlider" VerticalAlignment="Center" Minimum="0" Maximum="1" Width="50" Margin="0,0,0,0" MouseLeftButtonUp="MultiLayerOpacity" Value="{Binding ElementName=MyMap, Path=Layers[Aerials].Opacity, Mode=TwoWay}" />
Private Sub MultiLayerOpacity(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Dim Test As String = MySlider.Value Dim DynamicLayer1 As ArcGISDynamicMapServiceLayer = TryCast(MyMap.Layers("StreetMapLayer"), ArcGISDynamicMapServiceLayer) DynamicLayer1.Opacity = 1 - Test Dim DynamicLayer2 As ArcGISDynamicMapServiceLayer = TryCast(MyMap.Layers("Aerials"), ArcGISDynamicMapServiceLayer) DynamicLayer2.Opacity = Test End Sub
Private Sub MultiLayerOpacity(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Dim Test As String = MySlider.Value If Test > 0 Then MessageBox.Show("Yo") Dim DynamicLayer2 As ArcGISDynamicMapServiceLayer = TryCast(MyMap.Layers("Aerials"), ArcGISDynamicMapServiceLayer) DynamicLayer2.Opacity = Test End If End Sub
Private Sub MultiLayerOpacity(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Dim Test As String = MySlider.Value If Test > 0 Then Dim DynamicLayer2 As ArcGISDynamicMapServiceLayer = TryCast(MyMap.Layers("Aerials"), ArcGISDynamicMapServiceLayer) DynamicLayer2.Opacity = Test MessageBox.Show("Yo") End If End Sub
1. Why do I need this? Path=Layers[BaseLayerImage].Opacity, mean its specifying a specific layer?
2. ONE LAST question....how would i do this with 3 layers?
<Slider x:Name="MySlider" VerticalAlignment="Top" Minimum="0" Maximum="1" Margin="0,40,0,0" MouseLeftButtonUp="MultiLayerOpacity" Value="{Binding ElementName=MyMap, Path=Layers[BaseLayerImage].Opacity, Mode=TwoWay}" />
Private Sub MultiLayerOpacity(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Dim Test As String = MySlider.Value 'MessageBox.Show(Test) Dim DynamicLayer1 As ArcGISDynamicMapServiceLayer = TryCast(MyMap.Layers("StreetMapLayer"), ArcGISDynamicMapServiceLayer) DynamicLayer1.Opacity = Test Dim DynamicLayer2 As ArcGISDynamicMapServiceLayer = TryCast(MyMap.Layers("BaseLayerImage"), ArcGISDynamicMapServiceLayer) DynamicLayer2.Opacity = 1 - Test End Sub
Or are you saying add to the same map...
THen in VB I change the opacity based on the slider value?
You can just add your 2 layers to the map and when the slider value changed (from 0.0 to 1.0), initialize the opacity of your first layer with the slider value and the opacity of your second layer with 1-value.
<Slider x:Name="MySlider" VerticalAlignment="Top" Minimum="0" Maximum="1" Margin="0,40,0,0" MouseLeftButtonUp="GiveMeValue" Value="{Binding ElementName=MyMap, Path=Layers[BaseLayerImage].Opacity, Mode=TwoWay}" />
Private Sub GiveMeValue(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Dim Test As String = MySlider.Value MessageBox.Show(Test) End Sub
Do I create another <esri:map and define the two layers that will be effected with the slider?
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.