<!-- Snip inside MapTip of Feature --> <StackPanel Orientation="Vertical"> <Button x:Name="button" Background="Green" Width="40" Height="20" Content="button" Click="doThis" SEND TO VB SUB="{Binding[Field1]}" /> </StackPanel> <!-- Snip -->
I have a MapTip that is returning a value from a field....I need this value to be pushed to the VB code so I can do soemthing with it...
Can that be done...Say inthe Map Tip below I have this....when I click the Button it sends a Binding Value from a field to the VB Sub....
This is the field that I need the bound field value "{Binding [Field1]}" sent to the vb Sub "doThis" as seen below...
From a MapTip can I send a Binding Value to a VB sub ????
THanks
<!-- Snip inside MapTip of Feature --> <StackPanel Orientation="Vertical"> <Button x:Name="button" Background="Green" Width="40" Height="20" Content="button" Click="doThis" SEND TO VB SUB="{Binding[Field1]}" /> </StackPanel> <!-- Snip -->
<!-- Snip inside MapTip of Feature --> <StackPanel Orientation="Vertical"> <Button x:Name="button" Background="Green" Width="40" Height="20" Content="button" Command="{Binding GetMapTipValue}" CommandParameter="{Binding ElementName=MyMapTip}" </StackPanel> <!-- Snip -->
private RelayCommand<object> _getMapTipValue; public RelayCommand<object> GetMapTipValue { get { if (this._getMapTipValue == null) { this._getMapTipValue = new RelayCommand<object>(GetMapTipValueRelayMethod); } return this._getMapTipValue; } } private void GetMapTipValueRelayMethod(object commandParameter) { var result = (ESRI.ArcGIS.Client.Toolkit.MapTip)commandParameter; var result2 = (IDictionary<string, object>)result.ItemsSource; MessageBox.Show(result2["Field1"].ToString()); }
Private _getMapTipValue As RelayCommand(Of Object) Public ReadOnly Property GetMapTipValue() As RelayCommand(Of Object) Get If Me._getMapTipValue Is Nothing Then Me._getMapTipValue = New RelayCommand(Of Object)(AddressOf GetMapTipValueRelayMethod) End If Return Me._getMapTipValue End Get End Property Private Sub GetMapTipValueRelayMethod(ByVal commandParameter As Object) Dim result = DirectCast(commandParameter, ESRI.ArcGIS.Client.Toolkit.MapTip) Dim result2 = DirectCast(result.ItemsSource, IDictionary(Of String, Object)) MessageBox.Show(result2("Field1").ToString()) End Sub
Private _getMapTipValue As ICommand(Of Object) Public ReadOnly Property GetMapTipValue() As ICommand(Of Object) Get If Me._getMapTipValue Is Nothing Then Me._getMapTipValue = New ICommand(Of Object)(AddressOf GetMapTipValueRelayMethod) End If Return Me._getMapTipValue End Get End Property
<!-- Snip inside MapTip of Feature --> <Button Content="GetMapTipValue" Height="30" Width="150" Command="{Binding MapTipValueCommand}" CommandParameter="{Binding ElementName=MyMapTip}"> </Button> <!-- Snip inside MapTip of Feature -->
private MapTipValueCommand mapTipValueCommand; public MapTipValueCommand MapTipValueCommand { get { if (this.mapTipValueCommand == null) { this.mapTipValueCommand = new MapTipValueCommand(); } return this.mapTipValueCommand; } }
public class MapTipValueCommand:ICommand { public bool CanExecute(object parameter) { return true; } public event EventHandler CanExecuteChanged; public void Execute(object parameter) { var result = (ESRI.ArcGIS.Client.Toolkit.MapTip)parameter; var result2 = (IDictionary<string, object>)result.ItemsSource; MessageBox.Show(result2["XXX"].ToString()); } }
<!-- Snip from Map Tip --> <Button x:Name="bTurnOn3" Background="Red" Width="40" Height="20" Content="TurnON" Click="bTurnOn_Click3" Command="{Binding MapTipValueCommand}" CommandParameter="{Binding ElementName=MyMapTip}"/> <!-- Snip from Map Tip -->
Private m_mapTipValueCommand As MapTipValueCommand Public ReadOnly Property MapTipValueCommand() As MapTipValueCommand Get If Me.m_mapTipValueCommand Is Nothing Then Me.m_mapTipValueCommand = New MapTipValueCommand() End If Return Me.m_mapTipValueCommand End Get End Property
Public Class MapTipValueCommand Implements ICommand Public Function CanExecute(ByVal parameter As Object) As Boolean Return True End Function Public Event CanExecuteChanged As EventHandler Public Sub Execute(ByVal parameter As Object) Dim result = DirectCast(parameter, ESRI.ArcGIS.Client.Toolkit.MapTip) Dim result2 = DirectCast(result.ItemsSource, IDictionary(Of String, Object)) MessageBox.Show(result2("Field1").ToString()) End Sub End Class
Public Class MapTipValueCommand Implements ICommand Public Function CanExecute(parameter As Object) As Boolean Implements System.Windows.Input.ICommand.CanExecute Return True End Function Public Event CanExecuteChanged(sender As Object, e As System.EventArgs) Implements System.Windows.Input.ICommand.CanExecuteChanged Public Sub Execute(parameter As Object) Implements System.Windows.Input.ICommand.Execute Dim result = DirectCast(parameter, ESRI.ArcGIS.Client.Toolkit.MapTip) Dim result2 = DirectCast(result.ItemsSource, IDictionary(Of String, Object)) MessageBox.Show(result2("Field1").ToString()) End Sub End Class
<esri:FeatureLayer ID="Stops" Visible="False" Url="http://gi.org/arcgis/rest/services/MG_Test/MapServer/8" Renderer="{StaticResource BusStopUniqueRenderer}"> <esri:FeatureLayer.OutFields> <sys:String>Video</sys:String> </esri:FeatureLayer.OutFields> <esri:FeatureLayer.MapTip > <Border esri:GraphicsLayer.MapTipHideDelay="00:00:01.5" CornerRadius="10" BorderBrush="#FF222957" BorderThickness="0" Margin="0,0,15,15"> <Border.Background> <LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188"> <GradientStop Color="#FFD1DFF2"/> <GradientStop Color="#FF092959" Offset="0.946"/> </LinearGradientBrush> </Border.Background> <Border.Effect> <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" /> </Border.Effect> <Grid> <StackPanel Orientation="Vertical" Margin="10,10,0,10" VerticalAlignment="Center"> <Grid> <Button Content="GetMapTipValue" Width="100" Height="20" Command="{Binding MapTipValueCommand}" CommandParameter="{Binding ElementName=MyMapTip}"/> </Grid> </StackPanel> </Grid> </Border> </esri:FeatureLayer.MapTip> </esri:FeatureLayer>
Private m_mapTipValueCommand As MapTipValueCommand Public ReadOnly Property MapTipValueCommand() As MapTipValueCommand Get If Me.m_mapTipValueCommand Is Nothing Then Me.m_mapTipValueCommand = New MapTipValueCommand() End If Return Me.m_mapTipValueCommand MessageBox.Show("In the Get") End Get End Property
Public Class MapTipValueCommand Implements ICommand Public Function CanExecute(ByVal parameter As Object) As Boolean Implements System.Windows.Input.ICommand.CanExecute Return True End Function Public Event CanExecuteChanged(ByVal sender As Object, ByVal e As System.EventArgs) Implements System.Windows.Input.ICommand.CanExecuteChanged Public Sub Execute(ByVal parameter As Object) Implements System.Windows.Input.ICommand.Execute Dim result = DirectCast(parameter, ESRI.ArcGIS.Client.Toolkit.MapTip) Dim result2 = DirectCast(result.ItemsSource, IDictionary(Of String, Object)) MessageBox.Show(result2("Video").ToString()) End Sub End Class