IFrameworkViewSource 介面

定義

定義檢視提供者物件的處理站。

public interface class IFrameworkViewSource
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(3447129620, 26052, 17004, 148, 148, 52, 252, 67, 85, 72, 98)]
struct IFrameworkViewSource
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(3447129620, 26052, 17004, 148, 148, 52, 252, 67, 85, 72, 98)]
public interface IFrameworkViewSource
Public Interface IFrameworkViewSource
衍生
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

備註

當應用程式啟動時,實作這個類別的物件實例會提供給應用程式物件的 CoreApplication.Run 方法,這會使用它來建立應用程式所使用的檢視。

struct App : implements<App, IFrameworkViewSource, IFrameworkView>
{
public:
    IFrameworkView CreateView()
    {
        return *this;
    }
};

...

int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
{
    Windows::ApplicationModel::Core::CoreApplication::Run(App());
}

如果您使用 C++/CX,則檢視提供者必須屬性為 MTAThread。

ref class MyFrameworkViewSource : IFrameworkViewSource
{
public:
    virtual IFrameworkView^ CreateView()
    {
        return ref new MyFrameworkView(); // See IFrameworkView for implementation specifics.
    }
};

// ...

[Platform::MTAThread]
int main(Platform::Array<Platform::String^>^)
{
    auto frameworkViewSource = ref new MyFrameworkViewSource();
    Windows::ApplicationModel::Core::CoreApplication::Run(frameworkViewSource);
    return 0;
}

方法

CreateView()

傳回檢視提供者物件。

適用於

另請參閱