小编dot*_*gis的帖子

Xamarin在Xaml中形成OnPlatform

我有以下C#代码:

var footer = new StackLayout()
            { BackgroundColor = Device.OnPlatform(Color.FromRgb(225, 240, 251), Color.FromRgb(225, 240, 251), Color.Black),
            };
Run Code Online (Sandbox Code Playgroud)

如何将其转换为Xamarin Xaml,更重要的是,将其转换为FromRgb的设备平台规范?

到目前为止,我拥有以下XAML ...再次,是FromRgb困扰了我。

<StackLayout.BackgroundColor>
    <Color>
        <OnPlatform x:TypeArguments="Color"></OnPlatform>
    </Color>
</StackLayout.BackgroundColor>
Run Code Online (Sandbox Code Playgroud)

更新14/02/2015

我刚刚尝试了以下答案,但有以下内容,但它没有更新iOS或Windows Phone的背景色。如果我将背景色添加到根StackLayout元素中,它将起作用...:

<StackLayout HorizontalOptions="FillAndExpand">
    <StackLayout.BackgroundColor>
      <Color>
        <OnPlatform x:TypeArguments="Color">
          <OnPlatform.WinPhone>#51C0D4</OnPlatform.WinPhone>
          <OnPlatform.iOS>#51C0D4</OnPlatform.iOS>
        </OnPlatform>
      </Color>
    </StackLayout.BackgroundColor>
    <Label Text=""></Label>
    <StackLayout Orientation="Horizontal"  VerticalOptions="EndAndExpand" HorizontalOptions="FillAndExpand">
      <StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand">
      <Button Text="Login"></Button>
      <Button Text="Sign Up"></Button>
      </StackLayout>
    </StackLayout>
  </StackLayout>
Run Code Online (Sandbox Code Playgroud)

xaml xamarin.forms

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

将我的ApplicationsDbContext与IdentityDbContext结合使用没有使用MVC 5定义的键

我将现有的DBContext与MVC 5中的新IdentityDbContext结合起来.我设法将两个上下文组合在一起,但是当我运行我的应用程序并且正在创建模型时,我收到了以下错误消息:

Context.IdentityUserLogin :: EntityType'IdentityUserLogin'没有定义键.定义此EntityType的键.Context.IdentityUserRole :: EntityType'IdentityUserRole'没有定义键.定义此EntityType的键.

entity-framework asp.net-mvc-5 asp.net-identity

2
推荐指数
1
解决办法
663
查看次数