小编Ste*_*oix的帖子

Android上不支持全局支持PushAsync,请使用NavigationPage - Xamarin.Forms

我在Xamarin.Forms.ContentPage有线到按钮点击事件中有以下方法

public class LoginPage : ContentPage
{
    private Button _loginButton = null;
    private Entry _PasswordInput = null;
    private Entry _UsernameInput = null;

    public LoginPage()
    {
        _UsernameInput = new Entry { Placeholder = "Username" };
        _PasswordInput = new Entry { Placeholder = "Password", IsPassword = true };

        _loginButton = new Button
        {
            Text = "Login",
            BorderRadius = 5
        }

        _loginButton.Clicked += LogIn;

        Content = new StackLayout 
        {
            VerticalOptions = LayoutOptions.Center,
            Children = 
            {
                 _UsernameInput, _PasswordInput, _loginButton, 
            },
            Spacing = …
Run Code Online (Sandbox Code Playgroud)

navigation xamarin.android xamarin xamarin.forms

57
推荐指数
6
解决办法
5万
查看次数

如何使用await在自定义TaskScheduler上运行任务?

我有一些方法Task<T>可以随意返回await.我想让这些任务在自定义TaskScheduler而不是默认的上执行.

var task = GetTaskAsync ();
await task;
Run Code Online (Sandbox Code Playgroud)

我知道我可以创建一个新的TaskFactory (new CustomScheduler ())StartNew ()从中做一个,但是StartNew ()需要一个动作并创建它Task,我已经拥有了Task(在幕后由a返回TaskCompletionSource)

我怎样才能指定我自己TaskSchedulerawait

.net c# async-await

38
推荐指数
4
解决办法
3万
查看次数

Xamarin.Forms中的分隔符

我想在表单中使用水平分隔线.据我所知,Xamarin.Forms没有提供.

有人可以为分隔符提供一个片段吗?

更新1

根据Jason的提议,这看起来很好:

// draws a separator line and space of 5 above and below the separator    
new BoxView() { Color = Color.White, HeightRequest = 5  },
new BoxView() { Color = Color.Gray, HeightRequest = 1, Opacity = 0.5  },
new BoxView() { Color = Color.White, HeightRequest = 5  },
Run Code Online (Sandbox Code Playgroud)

呈现以下分隔线:

在此输入图像描述

xamarin xamarin.forms

34
推荐指数
5
解决办法
4万
查看次数

如何知道执行代码的当前操作系统/平台(Android/iOS)

使用Xamarin.Android和Xamarin.iOS,我现在需要共享代码部分中的当前操作系统.无论是enum,int还是字符串,都没关系.

我试过这个:

System.Environment.OSVersion
Run Code Online (Sandbox Code Playgroud)

对于某些内核版本信息,它始终是"Unix".

有关于Android的信息,例如

Android.OS.Build.VERSION
Run Code Online (Sandbox Code Playgroud)

但它需要在Android特定代码部分.有没有办法知道公共库中的当前操作系统?

c# xamarin.ios xamarin.android xamarin

27
推荐指数
2
解决办法
2万
查看次数

xamarin工作室中缺少类型或命名空间名称'Xamarin'

我收到此错误"MyApp\App.cs(7,7):错误CS0246:找不到类型或命名空间名称'Xamarin'(您是否缺少using指令或程序集引用?)(CS0246)" .我正在使用Xamarin工作室通过Xamarin.Forms制作跨平台应用程序,但每当我构建基本表单项目时,我得到此错误不知道为什么.我是xamarin的新手.如果有人知道答案,请帮助我.这是app.cs的代码:

using System;
using Xamarin.Forms;             //This is the line where error occurs

namespace FIrstFormProject
{
public class App
{
    public static Page GetMainPage ()
    {
        return new ContentPage {
            Content = new Label {
                Text = "Hello, Forms !",
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            },
        };
    }
}
}
Run Code Online (Sandbox Code Playgroud)

xamarin xamarin.forms

23
推荐指数
4
解决办法
7万
查看次数

无法使用令牌0100000f解析类型

iosxamarin表单中运行时出现此错误.我该如何解决这个问题?

System.TypeLoadException:无法使用标记0100000f解析类型

[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        global::Xamarin.Forms.Forms.Init();
        LoadApplication(new App());

        return base.FinishedLaunching(app, options);
    }
}
Run Code Online (Sandbox Code Playgroud)

xamarin xamarin.forms

15
推荐指数
1
解决办法
8867
查看次数

在PCL服务参考设置中禁用基于任务的异步操作

我目前正在构建一个基于Xamarin的移动应用程序.对于该项目,我创建了一个框架4.5的PCL项目.我使用VS 2013作为开发IDE.现在我想为此PCL添加WCF服务引用.在为此PCL项目添加服务引用时,我注意到禁用了异步操作的生成.请查看图像以获取更多详细信息.

在此输入图像描述

我通过Nuget将BCL.Async包添加到项目中.但我仍然无法从radiobutton列表(禁用)访问基于任务的操作.

那么有没有办法在服务客户端生成基于任务的异步操作?

wcf asynchronous portable-class-library xamarin xamarin.forms

13
推荐指数
1
解决办法
1475
查看次数

访问DependencyService中的ViewController以显示MFMailComposeViewController

如何在DependencyService中访问ViewController来呈现MFMailComposeViewController?我尝试使用Application.Context,但这似乎只适用于Android.有什么建议?

xamarin.ios xamarin xamarin.forms

13
推荐指数
3
解决办法
1万
查看次数

xamarin.forms从xaml绑定到property

我是xaml中绑定的新手,我有时候真的不明白.

我在我的xaml中有这个:

<ActivityIndicator IsRunning="{Binding IsLoading}" IsVisible="{Binding IsLoading}" />
Run Code Online (Sandbox Code Playgroud)

绑定"IsLoading".我在哪里声明/设置这个属性?!

我的.cs看起来像这样:

....
    public bool IsLoading;

    public CardsListXaml ()
    {
        InitializeComponent ();
        IsLoading = true;
 ....
Run Code Online (Sandbox Code Playgroud)

c# xaml xamarin.forms

11
推荐指数
1
解决办法
1万
查看次数

有没有办法在Xamarin.Forms中将样式与我的XAML分开

我在带有XAML页面的PCL中使用Xamarin.Forms.我想出的控制样式的唯一方法是使用内联语法.

<Button Text="Inquiry" TextColor="Blue" />
Run Code Online (Sandbox Code Playgroud)

我更喜欢使用像这样的结构:

<Page.Resources>
    <Style TargetType="Button">
        <Setter Property="BorderThickness" Value="5" />
        <Setter Property="Foreground" Value="Blue" />
    </Style>
</Page.Resources>
Run Code Online (Sandbox Code Playgroud)

(http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465381.aspx)

但是,尚未支持Style元素.有没有人成功地将布局与内容分开?

仅供参考:我也在Xamarin论坛上发布了这个问题,所以任何通过谷歌到这里的人都可能想查看这个页面:http://forums.xamarin.com/discussion/19287/styling-of-xamarin-xaml #最新

c# xaml xamarin xamarin.forms

10
推荐指数
2
解决办法
7006
查看次数