none
Cannot bind to Bing Map Center? RRS feed

  • Question

  • I'm getting this error:
    "Failed to assign to property 'Bing.Maps.Location.Latitude'."
    And, I thought perhaps it was because the Lat property was a double. So, I added a converter to
    return a string. But, I get the same error.

    If I remove the {binding} and use only constants then the code compiles and runs.

    What's wrong with this syntax?
    Thanks,
    Rick

    <Page.Resources> <CollectionViewSource x:Name="itemsViewSource" Source="{Binding Items}"/> <DataTemplate x:Key="MapTemplate"> <Grid Height="150" Width="480" Margin="10"> <Grid.Resources> <hp:DoubleToStringConveter x:Key="DoubleConverter"/> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="170" Height="150"> <bm:Map Height="150" HorizontalAlignment="Left" VerticalAlignment="Top" Width="170" ZoomLevel="16" Credentials="my_credentials" ShowScaleBar="False" > <bm:Map.Center> <bm:Location Latitude="{Binding Lat,Converter={StaticResource DoubleConverter}}" Longitude="-122.0416903" /> </bm:Map.Center> </bm:Map> </Border> <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0"> <TextBlock Text="{Binding LineOne}" Style="{StaticResource TitleTextStyle}" TextWrapping="NoWrap"/> <TextBlock Text="{Binding LineTwo}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/> <TextBlock Text="{Binding LineThree}" Style="{StaticResource BodyTextStyle}" MaxHeight="60"/> </StackPanel> </Grid> </DataTemplate> </Page.Resources>


    Monday, June 25, 2012 1:39 AM

Answers