1. I would like to be able to run the 2 classes from inside the MainPage.xaml.vbCan this be done? Yes...I don't know if its right way to do or may be it is... anyways look at my code belowI tried this by coping the 2 classes into the MainPage.xaml.vb page outside the main classThen removed the call to the ViewModel inteh UserControl in the mainpage.xamlThen removed <ViewModel:MainPageViewModel x:Key="vm" /> from the UserControl.Resources from teh mainpage.xamlThen changed the Button to reflect the class that is in the MainPage.xaml.vbI CHANGED THE BINDING below because I was not referencing the new class file... That right?Code: <Button Content="GetMapTipValue" Width="100" Height="20" Command="{Binding MapTipValueCommand}" CommandParameter="{Binding}" />2. How can I fire off the Story Board from within the New Class ... do I need to specify the MainPAge.xaml to run this? Or do I need a link back to the MainPage.xaml in the code (inherit)I don't knowMainPage.xaml.vb
Partial Public Class MainPage
Inherits UserControl
Public Sub New()
InitializeComponent()
End Sub
#Region "Intersect command"
Private m_mapTipValueCommand1 As MapTipValueCommand1
Public ReadOnly Property MapTipValueCommand1() As MapTipValueCommand1
Get
If Me.m_mapTipValueCommand1 Is Nothing Then
Me.m_mapTipValueCommand1 = New MapTipValueCommand1()
End If
Return Me.m_mapTipValueCommand1
End Get
End Property
#End Region
End Class
Public Class MapTipValueCommand1
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 result2 = DirectCast(parameter, IDictionary(Of String, Object))
MessageBox.Show(result2("NAME").ToString())
End Sub
End Class
MainPage.xaml
<UserControl x:Class="SilverlightApplication1_VB.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400"
x:Name="mainPage">
<Grid x:Name="LayoutRoot">
<!-- Map Control -->
<esri:Map x:Name="MyMap"
Extent="-15000000,2000000,-7000000,8000000">
<esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
<esri:FeatureLayer ID="MyFeatureLayer"
Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3">
<esri:FeatureLayer.MapTip>
<Border esri:GraphicsLayer.MapTipHideDelay="00:00:05"
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 ElementName=mainPage,Path= MapTipValueCommand1}"
CommandParameter="{Binding}" />
</Grid>
</StackPanel>
</Grid>
</Border>
</esri:FeatureLayer.MapTip>
</esri:FeatureLayer>
</esri:Map>
</Grid>
</UserControl>