|
The way an ARItem is displayed depends on the layer it's displayed on. For example,
OverheadMap and WorldView by default just display text. This can be changed by creating a DataTemplate that displays what you want and then telling the view to use that template. Creating a DataTemplate is outside the scope
of what I'll be able to provide here, but it's pretty simple. You just create a <DataTemplate> tag and inside of it you put child controls and bind them to the properties of ARItem that you want to show. The BingAR sample included with GART does this.
look inside of MainPage.xaml for the following line:
<DataTemplate x:Key
="RestaurantItem">...
You'll see the rest of the template defined under that.
Once the DataTemplate is defined you need to tell the view to use it. That's really easy with
WorldView because it has a dedicated property called
ItemTemplate. With OverheadMap it's a little more difficult because the DataTemplate has to be assigned to a layer. The controls default style does this for you automatically (inside of Generic.xaml) but it's not easily discovered. By
default the layer binds to a DataTemplate with the key MapShape. So, if you create a DataTemplate in your project and give it the key
MapShape then your customized template should show up on the map.
<DataTemplate x:Key="MapShape">...
We could add an ItemTemplate property to the
OverheadMap like there is on WorldView. The reason I didn't add it originally was because I thought someone might want different kinds of items to show up on different layers. But that doesn't quite work out since
there's only one collection of items. For that we really need DataTemplateSelector which doesn't exist in Silverlight. (Yes, I know there are workarounds.)
Hope that helps.
|