<Border x:Name="MapTipBorder" esri:GraphicsLayer.MapTipHideDelay="00:00:01" CornerRadius="10" BorderBrush="#FF222957" BorderThickness="3" 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> <StackPanel Orientation="Vertical" Margin="20,15,20,15"> <StackPanel Orientation="Horizontal" Margin="0,0,0,0"> <TextBlock Text="Beacon ID: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="12" /> <TextBlock Text="{Binding [BEACONID]}" Foreground="#FFFFFFFF" FontSize="12" FontStyle="Italic" FontFamily="Portable User Interface" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Vehicle Name: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="12" /> <TextBlock Text="{Binding [VEHICLENAME]}" Foreground="#FFFFFFFF" FontSize="12" FontStyle="Italic" FontFamily="Portable User Interface" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Date and Time: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="12" /> <TextBlock Text="{Binding [TIMESTAMP]}" Foreground="#FFFFFFFF" FontSize="12" FontStyle="Italic" FontFamily="Portable User Interface" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Speed: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="12" /> <TextBlock Text="{Binding [SPEED]}" Foreground="#FFFFFFFF" FontSize="12" FontStyle="Italic" FontFamily="Portable User Interface" /> </StackPanel> </StackPanel> </Border>
Graphic graphic = new Graphic(); graphic.Geometry = UnitLocation; //defined elsewhere _activeSymbol = (ESRI.ArcGIS.Client.Symbols.Symbol)LayoutRoot.Resources["GreenDotMarkerSymbol"]; graphic.Symbol = _activeSymbol; graphic.Attributes.Add("BEACONID", obj.beaconId); graphic.Attributes.Add("VEHICLENAME", obj.unitName); DateTime timestamp = obj.timestamp; graphic.Attributes.Add("TIMESTAMP", timestamp.AddHours(1)); //to correct for DST graphic.Attributes.Add("SPEED", obj.speed); graphic.MapTip = (FrameworkElement)LayoutRoot.Resources["MapTipBorder"]; graphic.MapTip.DataContext = graphic.Attributes; // have tried with and without this line. _serviceCrewLayer.Graphics.Add(graphic);
Solved! Go to Solution.