I have a collection of Users which are bound to a GraphicsLayer using a PointDataSource. The graphics appear OK, but the MapTips do not bind to the User properties.My User class looks like this:
public class User
{
public User()
{
//empty
}
public User(double lon, double lat)
{
this.Latitude = lat;
this.Longitude = lon;
}
public string FirstName { get; set; }
public string LastName { get; set; }
public double Longitude { get; set; }
public double Latitude { get; set; }
}
My ViewModel also exposes a Users ObservableCollection which is bound to my PointDataSource.<!-- data source -->
<esri:GraphicsLayer.GraphicsSource>
<esri:PointDataSource
ItemsSource="{Binding Source={StaticResource usersViewModel}, Path=Users}"
XCoordinateBinding="{Binding Longitude}"
YCoordinateBinding="{Binding Latitude}" >
</esri:PointDataSource>
</esri:GraphicsLayer.GraphicsSource>
How can I bind my MapTip to display the FirstName and LastName properties from my user? Currently I have this below, however the DataContext on the Border is always null. I don't know how to bind this to the point which contains the User instance for each specific map tip.<!-- tooltip -->
<esri:GraphicsLayer.MapTip>
<Border Padding="4,2" Background="Black" DataContext="{Binding [DataContext]}">
<StackPanel>
<TextBlock Foreground="White" Loaded="TextBlock_Loaded">
<Run Text="User: " />
<Run Text="{Binding FirstName}" />
<Run Text="{Binding LastName}" />
</TextBlock>
</StackPanel>
</Border>
</esri:GraphicsLayer.MapTip>
Graphics display correctly for each User (Lat/Long is good) but the MapTips appear empty.Thanks