小编Lam*_*rth的帖子

在F#中的自定义控件上创建Xamarin.Forms BindableProperty

我有F#+ Xamarin.Forms,没有实际使用C#。它工作正常,但是现在我正在尝试在要创建的控件上创建BindableProperty。它有点有效,但是当我尝试在XAML中使用{DynamicResource blah}或在带有Style的样式中进行绑定时,一切都会崩溃。

两者都起作用:

<dashboard:ProgressRing DotOnColor="#00d4c3" DotOffColor="#120a22" />
<dashboard:ProgressRing DotOnColor="{StaticResource dotOnColor}" DotOffColor="{StaticResource dotOffColor}" />
Run Code Online (Sandbox Code Playgroud)

无法运作:

<dashboard:ProgressRing DotOnColor="{DynamicResource dotOnColor}" DotOffColor="{DynamicResource dotOffColor}" />
Run Code Online (Sandbox Code Playgroud)

错误:

Xamarin.Forms.Xaml.XamlParseException:位置18:29。无法分配属性“ DotOnColor”:属性不存在或不可分配,或者值和属性之间的类型不匹配

XAML:

<?xml version="1.0" encoding="UTF-8"?>
<ContentView
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Dashboard.ProgressRing"
    x:Name="view">
  <AbsoluteLayout x:Name="absLayout">
    <!-- Dots are controlled in the code behind -->
  </AbsoluteLayout>
</ContentView>
Run Code Online (Sandbox Code Playgroud)

后面的代码:

namespace Dashboard

open System
open Xamarin.Forms
open Xamarin.Forms.Xaml

type ProgressRing() =
    inherit ContentView()

    do base.LoadFromXaml(typeof<ProgressRing>) |> ignore
    let absLayout = base.FindByName<AbsoluteLayout>("absLayout")

    static let dotOffColorProperty = BindableProperty.Create("DotOffColor", typeof<Color>, typeof<ProgressRing>, Color.Default)
    static let dotOnColorProperty = …
Run Code Online (Sandbox Code Playgroud)

xaml f# xamarin xamarin.forms

5
推荐指数
1
解决办法
589
查看次数

iOS上的B2C弹出窗口:“我的应用程序”想要使用“ b2clogin.com”登录

将Xamarin.Forms中的Microsoft.Identity.Client从1.x升级到4.x之后,大多数工作原理基本相同。但是,登录iOS会显示一个弹出窗口:

“我的应用”希望使用“ b2clogin.com”登录

这使应用程序和网站可以共享有关您的信息。

如果用户点击继续,也可以,但是几乎是无缝的。

据说它与iOS 12相关联,但这似乎并不是触发我的原因。有一个微软的文章,说这实际上是正常的,他说:

但是,在iOS上,用户可能必须同意浏览器才能回调该应用程序,这可能很烦人。

我发现可以设置.WithUseEmbeddedWebView(true),并且可以隐藏URL并删除弹出窗口,这适用于Facebook登录,但Google登录是一个难事。

存在通用链接而不是URL方案关联域的潜在路径。

调查该路径,看来我只需要使用以下JSON 设置URL https://myapp.b2clogin.com/.well-known/apple-app-site-association

{
  "webcredentials": {
    "apps": [
      "MYTEAMID.com.mycompany.myapp"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

不幸的是,我无法控制该URL。

还有其他想法吗?

xamarin.ios azure-ad-b2c

5
推荐指数
1
解决办法
123
查看次数

标签 统计

azure-ad-b2c ×1

f# ×1

xamarin ×1

xamarin.forms ×1

xamarin.ios ×1

xaml ×1