0

LocationCollection を MapPolyline の場所のプロパティにバインドする際に問題が発生しました。これは私の XAML コードの一部です:

<bm:Map x:Name="map" Credentials="MY_KEY" Grid.Column="1">
    <bm:Map.Children>
        <bm:MapItemsControl ItemTemplate="{StaticResource PushPinTemplate}" ItemsSource="{Binding HostsList}"/>
    </bm:Map.Children>
    <bm:Map.ShapeLayers>
        <bm:MapShapeLayer>
            <bm:MapShapeLayer.Shapes>
                <bm:MapPolyline Locations="{Binding PathLocations}" Color="Red" Width="5" />
            </bm:MapShapeLayer.Shapes>
        </bm:MapShapeLayer>
    </bm:Map.ShapeLayers>
</bm:Map>

そしてViewModel:

public ObservableCollection<HostDetailsModel> HostsList { get; set; }
private LocationCollection pathLocations;
public LocationCollection PathLocations 
{
   get { return pathLocations; }
   set { SetProperty(ref pathLocations, value); }
}

public TracePageViewModel()
{
    HostsList = new ObservableCollection<HostDetailsModel>();
    PathLocations = new LocationCollection();
    ....
}
....

アプリを起動すると、オンラインのページ コンストラクターで XamlParseException が発生しました。

this.InitializeComponent();

すべての間にコンテンツがなくて<bm:Map.ShapeLayers>...</bm:Map.ShapeLayers>も問題ありません。画鋲は正しくバインドされています。誰が何が起こっているのか知っていますか?前もって感謝します。

これが例外の StackTrace です。何か重要なことがあります。

StackTrace at Windows.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)\r\n at AppName.Views.TracePage.InitializeComponent() in c:\\Visual Studio 2012\\Projects\\AppName\\obj\\x86\\Debug\\Views\\TracePage.g.i.cs:line 44\r\n at AppName.Views.TracePage..ctor() in c:\\Visual Studio 2012\\Projects\\AppName\\Views\\TracePage.xaml.cs:line 26\r\n at AppName.AppName_XamlTypeInfo.XamlTypeInfoProvider.Activate_40_TracePage() in c:\\Visual Studio 2012\\Projects\\AppName\\obj\\x86\\Debug\\XamlTypeInfo.g.cs:line 177\r\n at AppName.AppName_XamlTypeInfo.XamlUserType.ActivateInstance() in c:\\Visual Studio 2012\\Projects\\AppName\\obj\\x86\\Debug\\XamlTypeInfo.g.cs:line 3698" string

4

0 に答える 0