【问题标题】:Microsoft Xaml Element Equivalent of Xamarin Xaml "ContentView"Xamarin Xaml“ContentView”的 Microsoft Xaml 元素等效项
【发布时间】:2016-04-12 15:25:48
【问题描述】:

我最近启动了一个专门用于通用 Windows 平台的 Xamarin Forms 项目。在尝试为应用程序添加一些全局样式时,我遇到了一个我不知道 uwp 等效语法的元素:Xamarin ContentView

(即我知道 Xamarin Label = UWPTextBlock,Xamarin HorizontalOptions = UWPHorizontalAlignment

Xamarin:

<Style x:Key="errorContainer" TargetType="ContentView">        
    <Setter Property="BackgroundColor" Value="Red"/>
    <Setter Property="HorizontalOptions" Value="Fill"/>
    <Setter Property="Padding" Value="15"/>
</Style>

UWP:

<Style x:Key="errorContainer" TargetType="?????????">
    <Setter Property="Background" Value="Red"/>
    <Setter Property="HorizontalAlignment" Value="Stretch"/>
    <Setter Property="Padding" Value="15"/>
</Style>

tldr; Xamarin ContentView = UWP ??????

感谢您的帮助

【问题讨论】:

  • 会是内容演示者吗?这是通用应用程序中的东西吗?这是一个 WPF 控件。

标签: xaml xamarin win-universal-app


【解决方案1】:

ContentControl(以及它的派生类型,如Border)应该满足您的需求。

(因为它具有 ContentTemplate 属性,因为 Xamarin.Forms 的 ContentView 派生自 TemplatedView。)

【讨论】:

    猜你喜欢
    • 2018-11-02
    • 1970-01-01
    • 2011-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-23
    • 1970-01-01
    相关资源
    最近更新 更多