【问题标题】:How can I create TeachingTip?如何创建教学提示?
【发布时间】:2020-05-18 14:37:19
【问题描述】:

我正在尝试以通常的方式将 TeachingTip 添加到 Xaml 文件中:

<TeachingTip/>

但我收到一个错误“找不到类型 'TeachingTip'”。

我尝试以编程方式在 cpp 文件 (C++/CX) 中添加:

TeachingTip^ tip = ref new TeachingTip();

错误是:“标识符'TeachingTip'未定义”。

所有其他控件都运行良好。

【问题讨论】:

    标签: xaml uwp c++-cx


    【解决方案1】:

    TechingTip 控件是Windows UI Library 的一部分,而不是 Windows。因此,它位于命名空间Microsoft.UI.Xaml.Controls(与Windows.UI.Xaml.Controls 相对)。若要在 XAML 中引用该控件,您必须使用正确的命名空间。 Getting started with the Windows UI Library有详细说明。

    以下 XAML 片段应该可以工作:

    <Page x:Class="..."
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
          ...
          >
    
        <muxc:TeachingTip/>
    
        ...
    </Page>
    

    同样,在代码中引用控件时,您必须指定正确的命名空间。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-30
      • 2021-02-03
      • 2018-06-25
      • 2016-07-16
      • 1970-01-01
      • 2020-10-29
      相关资源
      最近更新 更多