程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何在不同的 xaml 文件中访问 xaml 属性大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决如何在不同的 xaml 文件中访问 xaml 属性?

开发过程中遇到如何在不同的 xaml 文件中访问 xaml 属性的问题如何解决?下面主要结合日常开发的经验,给出你关于如何在不同的 xaml 文件中访问 xaml 属性的解决方法建议,希望对你解决如何在不同的 xaml 文件中访问 xaml 属性有所启发或帮助;

我有 2 个不同的 xaml 文件,例如 about 和 addgeoJson。第一个(关于)是:

@H_607_4@<?xml version="1.0" enCoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/scheR_561_11845@as/2014/forms" xmlns:x="http://scheR_561_11845@as.microsoft.com/winfx/2009/xaml" x:Class="mymapApp.VIEws.AboutPage" xmlns:vm="clr-namespace:mymapApp.viewmodels" xmlns:local="clr-namespace:Naxam.Controls.Forms;assembly=Naxam.MapBox.Forms" title="{Binding titlE}"> <ContentPage.bindingContext> <vm:Aboutviewmodel /> </ContentPage.bindingContext> <StackLayout> <local:MapVIEw x:name="map" x:FIEldModifIEr="Public" VerticalOptions="FillAndExpand" MapStyle="mapBox://styles/mapBox/satellite-v9" ZoomLevel="3" /> </StackLayout> </ContentPage>

我想访问地图视图对象,其中 x:name 是 addgeoJson xaml 文件中的地图。 about.map 是行不通的。我如何访问地图属性?我需要在其他文件中使用 map.functions。

-- 更新 --

现在,我创建了一个视图模型。我使用了一个实例来获取地图的值。我可以从任何地方访问中心、缩放与属性。此外,“customMap2”实际上具有 Functions 属性。但是,除了程序开始外,它返回 null。因此,我无法使用其他文件中的这些映射函数。我希望该用户从移动设备中选择一个 geoJson 文件并加载到地图。怎么了?

@H_607_4@using Naxam.Controls.Forms; using Naxam.MapBox; using System; using System.Collections.Generic; using System.Text; using Xamarin.Forms; namespace mymapApp.viewmodels { public class mapPage { private static mapPage _instance = new mapPage(); public static mapPage Instance { get { return _instance; } } public MapVIEw customMap2 = new MapVIEw { MapStyle = MapStyle.SATEliTE,VerticalOptions = Layoutoptions.FillAndExpand,ZoomLevel = 3,Functions = MapFunc }; private static IMapFunctions MapFunc { get; set; } public IMapFunctions GetFunc { get { return MapFunc; } set { return; } } } }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的如何在不同的 xaml 文件中访问 xaml 属性全部内容,希望文章能够帮你解决如何在不同的 xaml 文件中访问 xaml 属性所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:xaml属性