Uma*_* A. 0 c# silverlight bing-maps
我需要在加载页面控件之前从代码中设置CredentialsProvider.我在后面的代码中有"ApiKey"依赖属性并将其绑定到Bing Maps silverlight Control但它不起作用.它在运行时给出错误"无效凭据".
代码背后
public static readonly DependencyProperty ApiKeyProperty = DependencyProperty.Register("ApiKey", typeof(string), typeof(MainPage), new PropertyMetadata(""));
protected string ApiKey
{
get { return this.GetValue(ApiKeyProperty) as string; }
set { this.SetValue(ApiKeyProperty, value); }
}
Run Code Online (Sandbox Code Playgroud)
XAML
<m:Map x:Name="map" Grid.Row="1" Grid.ColumnSpan="5" Margin="0" CredentialsProvider="{Binding ElementName=silverlightMap, Path=ApiKey}"
Mode="Road" MouseMove="map_MouseMove" MouseLeftButtonUp="map_MouseLeftButtonUp" MouseLeftButtonDown="map_MouseLeftButtonDown"
ViewChangeEnd="map_ViewChangeEnd"></m:Map>
Run Code Online (Sandbox Code Playgroud)
类名是MainPage,是从UserControl继承的.
CredentialsProvider = new ApplicationIdCredentialsProvider("AbcdEfghIjklMNnoP_4rlMTclX8iXiNYUYQnG3GPYoxABCDEmoj3cCBemAAG")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2791 次 |
| 最近记录: |