Megosztás a következőn keresztül:


IFrameworkViewSource Interface

Definition

Defines a factory for view provider objects.

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
Derived
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Instances of objects that implement this class are provided to the app object's CoreApplication.Run method when the app starts, which uses it to create the views used by the app.

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

...

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

If you're using C++/CX, then a view provider must be attributed as 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;
}

Methods

CreateView()

Returns a view provider object.

Applies to

See also