【c# – Xamarin.Forms.Switch在更新值时发送Toggled事件】教程文章相关的互联网学习教程文章

如何使用自定义渲染器更改TableSection文本颜色-Xamarin.Forms C#【代码】

我有一个TableView在根目录中具有3个TableSections:var tableView = new TableView {RowHeight = 60,Root = new TableRoot{firstTableSection,secondTableSection,thirdTableSection,} }var firstTableSection = new TableSection("First") {// Cells }var firstTableSection = new TableSection("First") {// Cells }var firstTableSection = new TableSection("First") {// Cells }如何使用自定义渲染器更改TableSection文本的文...

c#-Xamarin在Android / iOS上通用的Xamarin.Forms代码

我正在寻找在Visual Studio 2015中创建一个Xamarin Forms PCL,它代表Xamarin Android项目和Xamarin iOS项目的通用应用程序代码(但不包括Windows或Windows Phone).我当前正在使用PCL配置文件111,该配置文件由提供的Xamarin模板创建. 一切都很好,直到我遇到了对System.IO.FileStream的支持.基于本文(在“保存和加载文件”部分中):https://developer.xamarin.com/guides/xamarin-forms/working-with/files/ Android和iOS都可以直接使...

c#-在Xamarin Studio中打开Visual Studio项目时,“版本字符串部分太短或太长”【代码】

我尝试在Xamarin Studio社区中从VS 2012打开解决方案,但其中一个项目-asp.net mvc项目-给出“版本字符串部分太短或太长” 我认为.net版本还可以. 我试图在VS中创建简单的asp.net mvc项目,然后在XS中打开它,一切正常.所以我不知道在这种情况下怎么了. 我找到了删除行的解决方案 VisualStudioVersion = {0} MinimumVisualStudioVersion = {0} 可以使用,但不适用于我.解决方法:就我而言,问题是.csproj文件中的此项:<Reference Includ...

C#-证明标签Xamarin形式的文本【代码】

我试图证明标签Xamarin表单中的文本合理,但无法解决,如何不使用webview像文本一样对文本进行正则化(而非仅对样式进行正则化) 我已经附上了我的代码,但只保留了理由string strText="MY LONG TEXT IS GOING HERE";var lblMSG = new Label {TextColor = Color.Black };lblMSG.Text=strText;lblMSG.LineBreakMode = LineBreakMode.WordWrap;lblMSG.HorizontalOptions = LayoutOptions.Fill;lblMSG.HorizontalTextAlignment = TextAlign...

c#-Intellisense在Xamarin的Visual Studio 2015中不适用于.cs文件

Xamarin项目中的所有.cs文件都是其他文件,未引用.Droid项目,即http://prntscr.com/cp3q4w.我在.cs文件中没有Intellisense,而且似乎某种程度上缺少对Xamarin.Forms http://prntscr.com/cp3qzr的引用,但由于未识别xamarin组件,我没有得到编译错误.这是Xamarin.Forms共享项目. 尝试过此解决方案:i)清除缓存ii)打开解决方案iii)卸载所有项目iv)加载Android项目,然后修复nuget引用v)修复引用后,我加载了共享项目.现在一切似乎都正常了....

c#-无法在Portrait,xamarin IOS中锁定一个视图控制器【代码】

我正在尝试仅使一个视图控制器锁定为纵向模式,同时允许所有其他视图为任意方向.这就是我试图放入homeViewController(我想保持肖像的那个)的方式.public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(){return UIInterfaceOrientationMask.Portrait;}public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation(){return UIInterfaceOrientation.Portrait;}public override ...

C#-捕获用户触摸的x和y,iOS Xamarin Forms【代码】

我正在使用Xamarin Forms(Xamarin Studio社区)来编写iOS应用.我只需要捕获用户触摸的坐标并释放按钮即可. 我已经在整个Google上进行了搜索,但只找到了根本不起作用的回复.它们要么用于Android,要么用于Swift,或者用于XCode,或者用于实际使用的方式太多. 我所看到的最接近的答案是:“当前在Xamarin Forms中无法做到这一点.”在我看来这很荒谬,因为它似乎是程序员需要的最基本,最基本的东西之一. 我需要做的就是捕获用户触摸并释放的...

我如何只接受C#Xamarin中的数字【代码】

我是Xamarin的C#新手.我使用Visual Studio for Mac Preview在iOS应用程序上工作.在制作基本计算器时,我无法弄清楚如何不接受不是数字的答案.例如,在“文本”框中,如果我输入字母,我想输入一个错误“Please enter a numeric digit”.我不知道为什么会出现错误,但无法正常工作. 当我运行它并输入一个数字时,它每次都默认为else语句.也有字母.当我放入太多字母时,它崩溃了.partial void AddButton_TouchUpInside(UIButton sender){dou...

Xamarin C#Android:更改子字符串中的颜色文本?【代码】

我需要用不同的颜色突出显示字符串中的一些单词.然后,该字符串将分配给TextView的Text属性.我没有找到一种简单有效的方法来执行此操作.你能帮助我吗?谢谢 .马多克斯解决方法: textview.SetTextColor(Color.ParseColor("#787887")); string character="Helloworld Developer"; string withoutspecialcharacter="Helloworld"; SpannableString spannable = new SpannableString(character); spannable.SetSpan(new ForegroundColorS...

c#-Xamarin.Forms绑定不起作用【代码】

我尝试使用XAML将Windows10的UWP C#应用程序重写为Xamarin应用程序.但是绑定(例如,在ListView ItemSource = …中)对我不起作用,我也不知道为什么.Visual Studio tells me, Cannot Resolve Symbol Recording due to unknown Data Context.这是我用于测试的XAML(MainPage.xaml):<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"xmlns:x="http://schemas.microsoft.com/winfx/2...

C#-使用Xamarin / Vision框架进行iOS条码检测【代码】

我想使用带有C#/ Xamarin的iOS 11的新视觉API检测条形码. 但是,xamarin的VNDetectBarcodesRequest类是抽象的.不是其他请求类型,例如VNDetectRectanglesRequest.框架的这一部分是否未在Xamarin中实现,还是我在这里遗漏了一些东西? 基本上,我想调整矩形检测样本(https://developer.xamarin.com/samples/monotouch/ios11/VisionRectangles/)以检测QR码. 非常感谢你!解决方法:更新:此错误已修复,查看xamarin-macios/issues/3140 这是...

c#-Xamarin Forms项目中以* CS.cs结尾的文件的用途是什么?【代码】

我正在学习一些Xamarin开发.当我研究Xamarin项目like this one的示例时,有时会看到一个页面包含一个神秘的文件,该文件的名称与xaml文件及其代码隐藏文件的名称相同,但是您看到的以* CS.cs结尾上面链接的项目中的LoginPage: > LoginPage.xaml> LoginPage.xaml.cs> LoginPageCS.cs< ---这是什么?LoginPage.xaml当然是布局的xaml描述,而LoginPage.xaml.cs是隐藏的代码.但是LoginPageCS.cs是什么?我可以将其从项目中删除,然后使用与...

C#-以Xamarin形式获取位置【代码】

嗨,大家好,我目前正在尝试从设备中获取位置信息,这是我正在使用的代码:public class Geolocation { private readonly LocationManager _locationManager;public Geolocation(){_locationManager = Forms.Context.GetSystemService(Context.LocationService) as LocationManager;}public Task<double> GetLocation(){var provider = _locationManager.GetBestProvider(new Criteria() { Accuracy = Accuracy.Fine }, true);...

通过Xamarin.Forms中的WebView中的Javascript onClick事件调用C#函数【代码】

我有一个WebView类型的帖子,我设法将它作为字符串与服务响应绑定在一起,但是我有一些链接,例如具有其ID的相关帖子.在单击这些链接时,我希望用户转到该文章.我尝试了许多解决方案,但看起来JavaScript不会在点击时调用,而是在加载时调用,因为我完整的WebView被视为字符串,并且如果将其串联起来,它肯定不会保留为脚本. 这是我完整的WebView代码,所附的屏幕截图是WebView中的链接. 我设法通过将整个响应串联在字符串中来使其工作.以下是...

C#-Xamarin-Android-Plugin.InAppBilling异常【代码】

我正在尝试通过使用plugin InAppBilling为Xamarin表单解决方案实施(In App Billing),我找不到该插件的任何完整代码示例或文档,除了this one时,我逐步按照说明进行操作,但是当我运行代码时,我得到了例外{System.NullReferenceException: Current Context/Activity is null,ensure that the MainApplication.cs file is setting the CurrentActivityin your source code so the In App Billing can use it. atPlugin.InAppBilling....

FORMS - 相关标签